# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
845083 | vjudge1 | Datum (COCI20_datum) | C++17 | 42 ms | 528 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define ll long long
#define pri pair<int,int>
#define prl pair<ll,ll>
#define vi vector<int>
#define vl vector<ll>
#define vp vector<pair<int,int>>
#define vpl vector<pair<ll,ll>>
#define re return 0
#define sqrt sqrtl
int check(int m, int d, int y) {
if (m==0 || d==0) return 0;
if (m>12) return 0;
if (m==1 || m==3 || m==5 || m==7 || m==8 || m==10 || m==12) {
if (d<=31) return 1;
else return 0;
} else if (m==2) {
if (y%4==0 && d<=29 || d<=28) return 1;
else return 0;
} else {
if (d<=30) return 1;
else return 0;
}
return 0;
}
int32_t main() {
int t;cin>>t;
while (t--) {
string s1;cin>>s1;
int d1 = s1[9]-48, d2 = s1[8]-48;
int d = d1*10 + d2;
int m1 = s1[7]-48, m2 = s1[6]-48;
int m = m1*10+ m2;
int y = m2*1000 + m1*100 + d2*10 + d1;
int cm = s1[4]-48 + (s1[3]-48)*10;
int cd = s1[1]-48 + (s1[0]-48)*10;
if ((cm<m || cm==m && cd<d) && check(m,d,y)) {
if (d/10 == 0) cout<<"0"<<d<<".";
else cout<<d<<".";
if (m/10==0) cout<<"0"<<m<<".";
else cout<<m<<".";
if (y/1000 == 0)cout<<"0"<<y;
else cout<<y;
cout<<"."<<endl;
} else {
int x = y+1;
while (1) {
int d1 = x%10, d2 = (x/10) % 10;
int m1 = (x/100)%10, m2 = (x/1000)%10;
int m = m1*10+m2;
int d = d1*10+d2;
if (check(m, d,x)) {
if (d/10 == 0) cout<<"0"<<d<<".";
else cout<<d<<".";
if (m/10==0) cout<<"0"<<m<<".";
else cout<<m<<".";
if (x/1000 == 0) cout<<"0"<<x;
else cout<<x;
break;
} x++;
}
cout<<"."<<endl;
}
}
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |