# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
845069 | vjudge1 | Datum (COCI20_datum) | C++17 | 24 ms | 348 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.
#include <bits/stdc++.h>
#define fast cin.tie(0)->sync_with_stdio(0);
#define int long long
#define inf ((int)1e18)
#define N 200005
using namespace std;
int days[] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; // 2.'ye dikkat
bool isLegit(int d, int m, bool leap) {
bool ret = 0;
if(leap) days[2]++;
if(m <= 12 and m > 0 and days[m] >= d and d > 0) {
ret = 1;
}
if(leap) days[2]--;
return ret;
}
void solve(){
int d, m, y;
char tmp;
cin>>d>>tmp>>m>>tmp>>y>>tmp;
for(int i = y; i < 10000; i++) {
int td = (i % 10) * 10 + (i / 10 % 10);
int tm = (i / 100 % 10) * 10 + (i / 1000 % 10);
bool isLarger = 1;
if(i == y) {
if(tm < m) isLarger = 0;
else if(tm == m) {
if(td > d) isLarger = 1;
else isLarger = 0;
}
else {
isLarger = 1;
}
}
if(isLegit(td, tm, !(i % 4)) and isLarger) {
if(td < 10) cout<<0;
cout<<td<<".";
if(tm < 10) cout<<0;
cout<<tm<<".";
if(i < 10) cout<<"000";
else if(i < 100) cout<<"00";
else if(i < 1000) cout<<0;
cout<<i<<".\n";
return;
}
}
}
int32_t main(){
fast
int t=1;
cin>>t;
while(t--) solve();
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |