# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
845661 | 2023-09-06T14:48:09 Z | vjudge1 | Datum (COCI20_datum) | C++17 | 18 ms | 504 KB |
#include <iostream> #include <vector> #include <cmath> #include <algorithm> #include <string> #include <map> #include <set> #include <queue> #include <deque> using namespace std; typedef long long int ll; typedef unsigned long long int ull; typedef long double ld; #define REP(i,a,b) for(ll i=a; i<b; i++) #define pb push_back #define mp make_pair #define pl pair<ll,ll> #define ff first #define ss second #define INF 100000000000000000LL ll insig; #define In(vecBRO, LENBRO) REP(IBRO,0,LENBRO) {cin>>insig; vecBRO.pb(insig);} void Out(vector<ll> x) {REP(i,0,x.size()) {cout<<x[i]<<" ";} cout<<endl;} string Expand(ll a, ll di) { string ans=""; REP(i,0,di) { ans+=((char) (((ll)('0')) + a%10)); a/=10; } reverse(ans.begin(),ans.end()); return ans; } ll inv(ll x) {ll d1=x/10; ll d2=x%10; return (10*d2+d1);} int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); ll T; cin>>T; vector<ll> lim; lim.pb(31); lim.pb(29); lim.pb(31); lim.pb(30); lim.pb(31); lim.pb(30); lim.pb(31); lim.pb(31); lim.pb(30); lim.pb(31); lim.pb(30); lim.pb(31); vector<ll> a; REP(i,0,10000) { ll m=inv(i/100); if(m>12 || m==0) {continue;} ll d=inv(i%100); if(d==0 || d>lim[m-1]) {continue;} if(m==2 && d==29 && i%4!=0) {continue;} a.pb(d+100*m+10000*i); } REP(t,0,T) { string s; cin>>s; vector<ll> digits; REP(i,0,s.size()) { if(s[i]=='.') {continue;} digits.pb((ll) (s[i]-'0')); } ll y=1000*digits[4]+100*digits[5]+10*digits[6]+digits[7]; ll m=10*digits[2]+digits[3]; ll d=10*digits[0]+digits[1]; ll v=10000*y+100*m+d; ll ans=*upper_bound(a.begin(),a.end(),v); d=ans%100; ans/=100; m=ans%100; ans/=100; y=ans; cout<<Expand(d,2)<<"."<<Expand(m,2)<<"."<<Expand(y,4)<<"."<<endl; } return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Correct | 15 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Correct | 0 ms | 348 KB | Output is correct |
5 | Correct | 0 ms | 348 KB | Output is correct |
6 | Correct | 0 ms | 348 KB | Output is correct |
7 | Correct | 0 ms | 348 KB | Output is correct |
8 | Correct | 0 ms | 348 KB | Output is correct |
9 | Correct | 1 ms | 504 KB | Output is correct |
10 | Correct | 18 ms | 488 KB | Output is correct |