# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
845064 | vjudge1 | Datum (COCI20_datum) | C++17 | 396 ms | 60084 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
/* Author : Mychecksdead */
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define MOD (1000000000+7)
#define MOD1 (998244353)
#define pb push_back
#define all(x) x.begin(), x.end()
#define en cout << '\n'
const int N = 1e6+100, M = 1e5+10, K = 18;
string pr(int a, int tp){
string res = to_string(a);
if(tp==0 || tp==1) if(res.length() == 2) return res; else return "0"+res;
if(res.length() == 4) return res;
if(res.length() == 3) return "0"+res;
if(res.length() == 2) return "00"+res;
return "000"+res;
}
bool check(array<int, 3>a ){
string s = pr(a[0], 0) + pr(a[1], 1) + pr(a[2], 2);
for(int i = 0; i < s.length()/2; ++i) if(s[i] != s[s.length()-1-i]) return false;
return 1;
}
int month[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
array<int, 3> a;
array<int, 3> dp[11000][35][12];
void solve(){
vector<array<int, 3>> cur;
a[0] = 0, a[1] = 0, a[2] = 0;
cur.pb(a);
for(int i = 0; i < 365*11000; ++i){
if(a[0] < month[a[1] - 1]) a[0]++;
else if(a[0] >= month[a[1] - 1]){
if(a[1] == 12){
a[0] = 1, a[1] = 1;
a[2]++;
}else if(a[1] == 2){
if(a[2] % 4 == 0){
if(a[0] == 29){
a[0] = 1;
a[1]++;
}else{
a[0]++;
}
}else{
a[0] = 1;
a[1]++;
}
}else{
a[1]++;
a[0] = 1;
}
}
if(check(a)){
for(auto k: cur){
dp[k[2]][k[0]][k[1]] = a;
}
cur.clear();
}
cur.pb(a);
}
int t; cin >> t;
for(int i = 0; i < t; ++i){
string s; cin >> s;
a[0] = (s[0]-'0')*10 + (s[1]-'0');
a[1] = (s[3]-'0')*10 + (s[4]-'0');
a[2] = (s[6]-'0')*1000 + (s[7]-'0')*100 + (s[8]-'0')*10 + (s[9]-'0');
cout << pr(dp[a[2]][a[0]][a[1]][0], 0) << '.' << pr(dp[a[2]][a[0]][a[1]][1], 1) << '.' << pr(dp[a[2]][a[0]][a[1]][2], 2) << ".\n";
}
}
int main(){
cin.tie(0); ios::sync_with_stdio(0);
int tt = 1, aa;
// freopen("in.txt", "r", stdin);
// freopen("out.txt", "w", stdout);
// cin >> tt;
while(tt--){
solve();
// en;
}
cerr<<"time taken : "<<(float)clock()/CLOCKS_PER_SEC<<" seconds\n";
return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |