-
Notifications
You must be signed in to change notification settings - Fork 0
/
D.cpp
38 lines (32 loc) · 872 Bytes
/
D.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// Problem: D. International Olympiad
// Contest: Codeforces - CROC 2016 - Final Round [Private, For Onsite Finalists Only]
// URL: https://codeforces.com/problemset/problem/662/D
// Memory Limit: 256 MB
// Time Limit: 1000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)
#include <bits/stdc++.h>
using namespace std;
const int MAX = 200007;
const int MOD = 1000000007;
void solve() {
char a, b, c, d;
string s;
cin >> a >> b >> c >> d >> s;
long long cnt = 0, mul = 10;
long long n = stoll(s);
for (int i = 1; i < s.size(); i++) {
cnt += mul;
mul *= 10;
}
while (n < 1989 + cnt) {
n += mul;
}
cout << n << endl;
}
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
//freopen("in.in", "r", stdin); freopen("out.out", "w", stdout);
int tt; cin >> tt; for (int i = 1; i <= tt; i++) {solve();}
//solve();
}