# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
845069 | vjudge1 | Datum (COCI20_datum) | C++17 | 24 ms | 348 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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... |