# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
845657 | vjudge1 | Datum (COCI20_datum) | C++17 | 15 ms | 600 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define pb push_back
const int inf = 100000000000000000LL;
string int_to_str(ll a, ll di)
{
string ans="";
for(int i = 0; i < di; ++i)
{
ans+=((char) (((ll)('0')) + a%10));
a/=10;
}
reverse(ans.begin(),ans.end());
return ans;
}
ll day(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{31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
vector<ll> a;
for(int i = 0; i < 10000; ++i)
{
ll m=day(i/100);
if(m>12 || m==0) {continue;}
ll d=day(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);
}
for(int t = 0; t < T; ++t)
{
string s; cin>>s;
vector<ll> digits;
for(int i = 0; i < s.size(); ++i)
{
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 << int_to_str(d,2) << "." << int_to_str(m,2) << "." << int_to_str(y,4) << "." << endl;
}
return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |