답안 #845650

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
845650 2023-09-06T14:41:55 Z vjudge1 Datum (COCI20_datum) C++11
5 / 50
1000 ms 684 KB
#include <bits/stdc++.h>
#define lg(a) (31 - __builtin_clz((a)))
// #define endl ("\n")
#define pb push_back
#define mp make_pair
#define lb lower_bound
#define ub upper_bound
#define vi vector<int>
#define st first
#define nd second
#define all(aa) aa.begin(), aa.end()
#define rall(aa) aa.rbegin(), aa.rend()
#define forn(i, n) for(int i=0;i<n;i++)
#define trav(e, x) for(auto& e:x)
#define until(n, v) (int) (lower_bound(v.begin(), v.end(), n)-v.begin()) //# of elements < n
#define after(n, v) (int) (v.end()-upper_bound(v.begin(), v.end(), n))   //# of elements > n
#define sameas(n, v) (int) (upper_bound(v.begin(), v.end(), n) - lower_bound(v.begin(), v.end(), n)) //# of elements ==n
typedef long long ll;
using namespace std;
/*

*/

vector<string> pal;


void precalc(){
	int m=0, d=0, y=0;
	char s[8];
	while (y < 1){
		d++; 
		if(d>=28){
			if(m==1 or m==3 or m==5 or m==7 or m==8 or m==10 or m==12){
				d = (d-1)%31 + 1;
				m += d/31;
				m = (m-1)%12 +1;
				y +=m/12; 
			}
			if(m==4 or m==6 or m==9 or m==11){
				d = (d-1)%30 + 1;
				m += d/30;
				m = (m-1)%12 +1;
				y +=m/12;
			}
			if(m==2 and y%4!=0){
				d = (d-1)%28 + 1;
				m += d/28;
				m = (m-1)%12 +1;
				y +=m/12;
			}
			else{
				if(m==2 and y%4==0){
				d = (d-1)%29 + 1;
				m += d/29;
				m = (m-1)%12 +1;
				y +=m/12;
				}
			}
		}
		s[0] = d/10;
		s[1] = d%10;
		s[2] = m/10;
		s[3] = m%10;
		s[4] = y/1000;
		s[5] = (y/100)%10;
		s[6] = (y/10) % 10;
		s[7] = y%10;
		if(s[0]==s[7] and s[1] == s[6] and s[2]==s[5] and s[3]==s[4]){
			pal.pb(s);
			cout<<"a"<<endl;
		}
	}
}


void solve(){
	string a; cin>>a;
	int d=(a[0]-'0')*10 + (a[1]-'0'), m = (a[3]-'0')*10 + (a[4]-'0'), y=1000*(a[6]-'0') + 100*(a[7]-'0')+10*(a[8]-'0')+(a[9]-'0');
	int s[8];
	int ispal=0;
	while (!ispal){
		d++; 
		if(d>=28){
			if(m==1 or m==3 or m==5 or m==7 or m==8 or m==10 or m==12){
				d = (d-1)%31 + 1;
				m += d/31;
				m = (m-1)%12 +1;
				y +=m/12; 
			}
			if(m==4 or m==6 or m==9 or m==11){
				d = (d-1)%30 + 1;
				m += d/30;
				m = (m-1)%12 +1;
				y +=m/12;
			}
			if(m==2 and y%4!=0){
				d = (d-1)%28 + 1;
				m += d/28;
				m = (m-1)%12 +1;
				y +=m/12;
			}
			else{
				if(m==2 and y%4==0){
				d = (d-1)%29 + 1;
				m += d/29;
				m = (m-1)%12 +1;
				y +=m/12;
				}
			}
		}
		s[0] = d/10;
		s[1] = d%10;
		s[2] = m/10;
		s[3] = m%10;
		s[4] = y/1000 ;
		s[5] = (y/100)%10 ;
		s[6] = (y/10) % 10 ;
		s[7] = y%10;
		// cout<<s[0]<<s[1]<<'.'<<s[x2]<<s[3]<<'.'<<s[4]<<s[5]<<s[6]<<s[7]<<endl;
		if(s[0]==s[7] and s[1] == s[6] and s[2]==s[5] and s[3]==s[4]){
			ispal=1;
		}
	}
	cout<<s[0]<<s[1]<<'.'<<s[2]<<s[3]<<'.'<<s[4]<<s[5]<<s[6]<<s[7]<<'.'<<endl;

}

int main(){
	// precalc();
	int test; 
    cin >> test;
   	while (test--){
		solve();
    }
}



# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Execution timed out 1069 ms 684 KB Time limit exceeded
3 Incorrect 0 ms 348 KB Output isn't correct
4 Incorrect 3 ms 428 KB Output isn't correct
5 Incorrect 4 ms 344 KB Output isn't correct
6 Incorrect 5 ms 348 KB Output isn't correct
7 Incorrect 7 ms 348 KB Output isn't correct
8 Incorrect 7 ms 344 KB Output isn't correct
9 Incorrect 7 ms 348 KB Output isn't correct
10 Execution timed out 1058 ms 668 KB Time limit exceeded