#include <bits/stdc++.h>
using namespace std;
int days[12] = {31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
map<int, string> str;
map<string, int> num;
vector<int> vec;
void solve(){
string s;
cin >> s;
int MM = (s[3] - '0') * 10 + (s[4] - '0');
int DD = (s[0] - '0') * 10 + (s[1] - '0');
int Y = ((((((s[6] - '0') * 10) + (s[7] - '0')) * 10) + (s[8] - '0')) * 10) + (s[9] - '0');
for (int year = Y; year < 10000; year ++){
string y = to_string(year);
while (y.size() < 4) y = '0' + y;
int d = (y[3] - '0') * 10 + (y[2] - '0');
int m = (y[1] - '0') * 10 + (y[0] - '0');
if (m == 0 or m > 12) continue;
if (d == 0 or days[m - 1] < d) continue;
string dd = to_string(d);
while (dd.size() < 2) dd = '0' + dd;
string mm = to_string(m);
while (mm.size() < 2) mm = '0' + mm;
if (year > Y or (year == Y and (m > MM or (m == MM and d > DD)))){
cout << dd << '.' << mm << '.' << y << '.' << endl;
return;
}
}
}
int main(){
int t;
cin >> t;
while (t--)
solve();
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
67 ms |
464 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
68 ms |
504 KB |
Output is correct |