# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
238645 | vankata | Datum (COCI20_datum) | C++14 | 81 ms | 384 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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";
}
bool adequate(int d,int m,int y)
{
if(d>31||m>12||d==0||m==0)return false;
if(d==31&&(m==2||m==4||m==6||m==9||m==11))return false;
if(d==30&&m==2)return false;
if(d==29&&m==2)
{
if(y%4!=0)return false;
}return true;
}
void solve()
{
string s;
cin>>s;
int d=0,a,b,l=0,i;
int m=0;
int y=0;
for(i=0; i<s.size(); i++)
{
if(s[i]=='.')l++;
else
{
if(l==0)
{
d*=10;
d+=s[i]-'0';
}
else if(l==1)
{
m*=10;
m+=s[i]-'0';
}
else
{
y*=10;
y+=s[i]-'0';
}
}
}
for(i=0; i<=9999; i++)
{
l=i;
a=l%10;
a*=10;l/=10;
a+=l%10;
l/=10;
b=l%10;
b*=10;l/=10;
b+=l;
if(i<y)continue;
else
{
if(i==y&&b<m)continue;
else
{
if(i==y&&b==m&&a<=d)continue;
}
}
if(adequate(a,b,i))
{
print(a,b,i);
break;
}
}
}
int main()
{
int n;
cin>>n;
while(n--)solve();
return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |