#include<bits/stdc++.h>
using namespace std;
void print(int a,int b,int c)
{
if(a<10)cout<<0;
cout<<a;
cout<<".";
if(b<10)cout<<0;
cout<<b;
cout<<".";
if(c<1000)cout<<0;
cout<<c;
cout<<".\n";
}
void solve()
{
string s;
cin>>s;
int d,a,b,l,i;
int m;
int y;
d = (s[0]-'0')*10+(s[1]-'0');
m = (s[3]-'0')*10+(s[4]-'0');
y = (((s[6]-'0')*10+(s[7]-'0'))*10+(s[8]-'0'))*10+(s[9]-'0');
for(i=max(y,100);i<=9999;i++)
{
l=i;
a=l%10;
a*=10;
l/=10;
a+=l%10;
l/=10;
b=l%10;
l/=10;
b*=10;
b+=l%10;
if(a&&b)
{
if(b==2)
{
if(i%4==0&&i%400!=0)
{
if(a>29)continue;
}
else
if(a>28)continue;
}
else if(b==1||b==3||b==5||b==7||b==8||b==10||b==12)
{
if(a>31)continue;
}
else if(b>12)continue;
else if(a>30)continue;
}
else continue;
if(i==y)
{
if(b>=m)
{
if(a<=d)continue;
}
else continue;
}
print(a,b,i);
break;
}
}
int main()
{
int n;
cin>>n;
while(n--)solve();
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
256 KB |
Output is correct |
2 |
Incorrect |
58 ms |
512 KB |
Output isn't correct |
3 |
Correct |
5 ms |
384 KB |
Output is correct |
4 |
Incorrect |
5 ms |
384 KB |
Output isn't correct |
5 |
Incorrect |
5 ms |
384 KB |
Output isn't correct |
6 |
Correct |
5 ms |
256 KB |
Output is correct |
7 |
Incorrect |
5 ms |
256 KB |
Output isn't correct |
8 |
Correct |
5 ms |
256 KB |
Output is correct |
9 |
Correct |
5 ms |
256 KB |
Output is correct |
10 |
Incorrect |
55 ms |
512 KB |
Output isn't correct |