Submission #238445

# Submission time Handle Problem Language Result Execution time Memory
238445 2020-06-11T10:54:53 Z vankata Datum (COCI20_datum) C++14
35 / 50
53 ms 384 KB
#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;
        l/=10;
        a*=10;
        a+=l%10;
        l/=10;

        b=l%10;
        b*=10;
        l/=10;
        b+=l%10;

        if(a>31||b>12||a==0||b==0)continue;

        if(y==i&&d==a&&m==b)continue;

        if(i%4==0)
        {
            if(b==2)
            {
                if(a>29)continue;
            }
        }
        else
        {
            if(b==2)
            {
                if(a>28)continue;
            }
        }

        if(b==1||b==3||b==5||b==7||b==8||b==10||b==12)
        {
            if(a>31)continue;
        }
        else if(a>30)continue;

        print(a,b,i);
        break;
    }
}
int main()
{
    int n;
    cin>>n;
    while(n--)solve();
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 5 ms 256 KB Output is correct
2 Incorrect 53 ms 384 KB Output isn't correct
3 Correct 4 ms 256 KB Output is correct
4 Correct 4 ms 256 KB Output is correct
5 Correct 5 ms 256 KB Output is correct
6 Incorrect 4 ms 256 KB Output isn't correct
7 Correct 4 ms 256 KB Output is correct
8 Correct 4 ms 256 KB Output is correct
9 Correct 4 ms 256 KB Output is correct
10 Incorrect 53 ms 384 KB Output isn't correct