# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
998996 | vjudge1 | Datum (COCI20_datum) | C++17 | 68 ms | 504 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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;
int MM = (s[3] - '0') * 10 + (s[4] - '0');
int DD = (s[0] - '0') * 10 + (s[1] - '0');
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;
int d = (y[3] - '0') * 10 + (y[2] - '0');
int m = (y[1] - '0') * 10 + (y[0] - '0');
if (m == 0 or m > 12) continue;
if (d == 0 or days[m - 1] < d) continue;
string dd = to_string(d);
while (dd.size() < 2) dd = '0' + dd;
string mm = to_string(m);
while (mm.size() < 2) mm = '0' + mm;
if (year > Y or (year == Y and (m > MM or (m == MM and d > DD)))){
cout << dd << '.' << mm << '.' << y << '.' << endl;
return;
}
}
}
int main(){
int t;
cin >> t;
while (t--)
solve();
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |