# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
845083 | 2023-09-06T11:53:20 Z | vjudge1 | Datum (COCI20_datum) | C++17 | 42 ms | 528 KB |
#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
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Correct | 41 ms | 528 KB | Output is correct |
3 | Correct | 1 ms | 344 KB | Output is correct |
4 | Correct | 0 ms | 348 KB | Output is correct |
5 | Correct | 0 ms | 344 KB | Output is correct |
6 | Correct | 1 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 | 42 ms | 520 KB | Output is correct |