#pragma GCC optimize("unroll-loops,Ofast,O3")
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define spc << " " <<
#define all(x) x.begin(), x.end()
#define ll long long
#define int long long
#define ii pair<int,int>
#define vi vector<int>
#define vii vector<ii>
#define st first
#define nd second
#define inf 1000000009
#define MOD 1000000007
using namespace std;
void solve(){
string s; cin >> s;
int yea=(s[6]-'0')*1000 + (s[7]-'0')*100 + (s[8]-'0')*10 + (s[9]-'0');
int mon=(s[3]-'0')*10 + (s[4]-'0');
int day=(s[0]-'0')*10 + (s[1]-'0');
for(int n=yea; n<=2113; n++){
int d1=n/1000, d2=(n%1000)/100, d3=(n%100)/10, d4=n%10;
int nmon=(d2*10)+d1;
if(nmon>12 || nmon==0 || (n==yea && nmon<mon)) continue;
int nday=(d4*10)+d3;
if(nday>31 || nday==0 || (n==yea && nmon==mon && nday<=day)) continue;
if((nmon==4 || nmon==6 || nmon==9 || nmon==11) && nday>30) continue;
if(n%4==0){
if(nmon==2 && nday>28) continue;
}
else{
if(nmon==2 && nday>29) continue;
}
cout << d4 << d3 << "." << d2 << d1 << "." << d1 << d2 << d3 << d4 << "." << endl;
return;
}
}
signed main(){
ios_base::sync_with_stdio(false);cin.tie(0);
#ifdef Local
freopen("in.txt","r",stdin);
freopen("out","w",stdout);
#endif
ll t=1;
cin >> t;
while(t--) solve();
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
2 |
Incorrect |
7 ms |
348 KB |
Output isn't correct |
3 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
4 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
5 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
6 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
7 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
8 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
9 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
10 |
Incorrect |
6 ms |
480 KB |
Output isn't correct |