# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
998994 | vjudge1 | Datum (COCI20_datum) | C++17 | 140 ms | 452 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>
using namespace std;
int days[12] = {31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
map<int, string> str;
map<string, int> num;
vector<int> vec;
void solve(){
string s;
cin >> s;
string DD = s.substr(0, 2);
string MM = s.substr(3, 2);
int Y = ((((((s[6] - '0') * 10) + (s[7] - '0')) * 10) + (s[8] - '0')) * 10) + (s[9] - '0');
for (int year = Y; year < 10000; year ++){
string y = to_string(year);
while (y.size() < 4) y = '0' + y;
string d, m;
d += y[3];
d += y[2];
m += y[1];
m += y[0];
if (m == "00" or m > "12") continue;
int mo = (m[0] - '0') * 10 + (m[1] - '0');
if (d == "00" or to_string(days[mo - 1]) < d) continue;
if (year > Y or (year == Y and (m > MM or (m == MM and d > DD)))){
cout << d << '.' << m << '.' << y << endl;
return;
}
}
}
int main(){
int t;
cin >> t;
while (t--)
solve();
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |