# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
845583 | vjudge1 | Datum (COCI20_datum) | C++17 | 24 ms | 604 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#pragma GCC optimize("unroll-loops,Ofast,O3")
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define spc << " " <<
#define all(x) x.begin(), x.end()
#define ll long long
#define int long long
#define ii pair<int,int>
#define vi vector<int>
#define vii vector<ii>
#define st first
#define nd second
#define inf 1000000009
#define MOD 1000000007
using namespace std;
void solve(){
string s; cin >> s;
int yea=(s[6]-'0')*1000 + (s[7]-'0')*100 + (s[8]-'0')*10 + (s[9]-'0');
int mon=(s[3]-'0')*10 + (s[4]-'0');
int day=(s[0]-'0')*10 + (s[1]-'0');
for(int n=yea; n<=9999; n++){
int d1=n/1000, d2=(n%1000)/100, d3=(n%100)/10, d4=n%10;
int nmon=(d2*10)+d1;
if(nmon>12 || nmon==0 || (n==yea && nmon<mon)) continue;
int nday=(d4*10)+d3;
if(nday>31 || nday==0 || (n==yea && nmon==mon && nday<=day)) continue;
if((nmon==4 || nmon==6 || nmon==9 || nmon==11) && nday>30) continue;
if(n%4==0){
if(nmon==2 && nday>29) continue;
}
else{
if(nmon==2 && nday>28) continue;
}
cout << d4 << d3 << "." << d2 << d1 << "." << d1 << d2 << d3 << d4 << "." << endl;
return;
}
cout << "we failed :(" << endl;
}
signed main(){
ios_base::sync_with_stdio(false);cin.tie(0);
#ifdef Local
freopen("in.txt","r",stdin);
freopen("out","w",stdout);
#endif
ll t=1;
cin >> t;
while(t--) solve();
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |