제출 #238504

#제출 시각아이디문제언어결과실행 시간메모리
238504SalitoDatum (COCI20_datum)C++14
35 / 50
34 ms384 KiB
#include<bits/stdc++.h> using namespace std; int month(int y,int m) { if(m==1 || m==3 || m==5 || m==7 || m==8 || m==10 || m==12) return 3; if(m!=2)return 2; if(y%4 == 0) return 1; return 0; } void solve(string s) { int d,m,y1,y2,y; d=(s[0]-'0')*10+s[1]-'0'; m=(s[3]-'0')*10+s[4]-'0'; y1=(s[7]-'0')*10+s[6]-'0'; y2=(s[9]-'0')*10+s[8]-'0'; y=(s[8]-'0')*10+s[9]-'0'; if(m == y1 && d < y2 && y2 <= 28 + month(y,m)) { if(y2<10)cout<<0; cout<<y2<<"."; if(m<10)cout<<0; cout<<m<<"."<<s[6]<<s[7]<<s[8]<<s[9]<<".\n"; return ; } if(y1>12) { y = (s[6]-'0')*10+s[7]-'0'; do { y++; y1 = (y%10) *10 + y/10; }while(y1 >12); cout<<"10."; if(y1<10) cout<<"0"; cout<<y1<<"."; if(y<10)cout<<"0"; cout<<y<<"01.\n"; return ; } y1=(s[6]-'0')*10+s[7]-'0'; y2=(s[8]-'0')*10+s[9]-'0'; m = (y1%10) *10 + y1/10; if(m/10 == s[3]-'0' && m%10 == s[4]-'0')y2++; while(y2<100) { int ry; ry = (y2%10) *10 + y2/10; if(ry <= 28 +month(y2,m)) { if(ry<10) cout<<0; cout<<ry<<"."; if(m<10)cout<<0; cout<<m<<"."; if(y1<10)cout<<0; cout<<y1; if(y2<10)cout<<0; cout<<y2<<".\n"; return ; } y2++; } y = (s[6]-'0')*10+s[7]-'0'; //y++; do { y++; y1 = (y%10) *10 + y/10; }while(y1 >12); cout<<"10."; if(y1<10) cout<<"0"; cout<<y1<<"."; if(y<10)cout<<"0"; cout<<y<<"01.\n"; return ; } int main() { string s; int n,i; cin>>n; for(i=0;i<n;i++) { cin>>s; solve(s); } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...