# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
845086 | vjudge1 | Datum (COCI20_datum) | C++14 | 21 ms | 520 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
// Aber der schlimmste Fiend, dem du begegnen kannst, wirst du immer dir selber sein
#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast,unroll-loops")
#pragma GCC target("avx2,popcnt,lzcnt,abm,bmi,bmi2,fma,tune=native")
#define fast_io ios_base::sync_with_stdio(false);cin.tie(NULL);
#define ff first
#define ss second
#define pb push_back
#define rev reverse
#define all(x) x.begin(),x.end()
#define acc accumulate
#define sz size()
#define MOD 1000000007
#define rall(x) x.rbegin(),x.rend()
#define rep(i, x, n) for(int i = x; i < n; i++)
using namespace std;
const int N = 2e5 + 5;
int arr[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
int check(int d, int m, int y){
m--;
if(d == 0) return 0;
if(d <= arr[m]) return 1;
if(d == 29 && m == 1 && y % 4 == 0) return 1;
return 0;
}
inline void solve(){
int n;
cin >> n;
for(int i = 0; i < n; i++){
string s;
cin >> s;
int year;
year = (s[6] - '0') * 1000 + (s[7] - '0') * 100 + (s[8] - '0') * 10 + (s[9] - '0');
if(s[0] == s[9] && s[1] == s[8] && s[3] == s[7] && s[4] == s[6]){
year++;
}
int year_in_arr[4];
year_in_arr[0] = year / 1000;
year %= 1000;
year_in_arr[1] = year / 100;
year %= 100;
year_in_arr[2] = year / 10;
year %= 10;
year_in_arr[3] = year;
year = year_in_arr[0] * 1000 + year_in_arr[1] * 100 + year_in_arr[2] * 10 + year_in_arr[3];
while(1){
int d = year_in_arr[3] * 10 + year_in_arr[2];
int m = year_in_arr[1] * 10 + year_in_arr[0];
int y = year;
if(check(d, m, y)){
cout << ((d < 10) ? "0" : "") << d << "." << ((m < 10) ? "0" : "") << m << "." << ((y < 10) ? "000" : ((y < 100) ? "00" : ((y < 1000) ? "0" : ""))) << y << "." << endl;
break;
}
year++;
year_in_arr[3]++;
if(year_in_arr[3] == 10) year_in_arr[3] = 0, year_in_arr[2]++;
if(year_in_arr[2] == 10) year_in_arr[2] = 0, year_in_arr[1]++;
if(year_in_arr[1] == 10) year_in_arr[1] = 0, year_in_arr[0]++;
}
}
}
int main(){
fast_io
int t;
t = 1;
while(t--) solve();
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |