結果

問題 No.721 Die tertia (ディエ・テルツィア)
ユーザー t98slidert98slider
提出日時 2020-07-05 07:12:32
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 1,304 bytes
コンパイル時間 1,952 ms
コンパイル使用メモリ 168,060 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-21 20:42:24
合計ジャッジ時間 2,794 ms
ジャッジサーバーID
(参考情報)
judge13 / judge10
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 2 ms
4,348 KB
testcase_03 AC 2 ms
4,348 KB
testcase_04 AC 2 ms
4,348 KB
testcase_05 AC 2 ms
4,348 KB
testcase_06 AC 2 ms
4,348 KB
testcase_07 AC 2 ms
4,348 KB
testcase_08 AC 2 ms
4,348 KB
testcase_09 AC 2 ms
4,348 KB
testcase_10 AC 2 ms
4,348 KB
testcase_11 AC 2 ms
4,348 KB
testcase_12 AC 2 ms
4,348 KB
testcase_13 AC 2 ms
4,348 KB
testcase_14 AC 2 ms
4,348 KB
testcase_15 AC 2 ms
4,348 KB
testcase_16 AC 2 ms
4,348 KB
testcase_17 AC 2 ms
4,348 KB
testcase_18 AC 2 ms
4,348 KB
testcase_19 AC 2 ms
4,348 KB
testcase_20 AC 2 ms
4,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define rep(i,n) for (int i=0;i<(int)(n);i++)
#define codefor int test;cin>>test;while(test--)
#define vec_input(v) for(auto it=v.begin();it!=v.end();it++){cin>>*it;}
#define vec_output(v) for(auto it=v.begin();it!=v.end();it++){if(it!=v.begin())cout<<" ";cout<<*it;}cout<<endl;
#define vec_debug(v) for(auto it=v.begin();it!=v.end();it++){cerr<<*it<<" ";}cerr<<endl;
#define yn(ans) cout<<(ans?"Yes":"No")<<endl
#define YN(ans) cout<<(ans?"YES":"NO")<<endl
#define umap unordered_map
#define uset unordered_set
using namespace std;
using ll = long long;

int main(){
    int y,m,d;
    scanf("%d/%d/%d",&y,&m,&d);
    vector<int> vec={31,28,31,30,31,30,31,31,30,31,30,31};
    if(m==12&&(d==30||d==31)){
        printf("%04d/%02d/%02d\n",y+1,1,d-29);
        return 0;
    }else{
        if(d+2<=vec[(m-1)]){
            d+=2;
        }else if(m!=2){
            d+=2-vec[m-1];
            m++;
        }else{
            d+=2;
            if(y%400==0||(y%4==0&&y%100!=0)){
                if(d==30){
                    d=1;
                    m=3;
                }
            }else{
                d-=vec[m-1];
                m++;
            }
        }
    }
    printf("%04d/%02d/%02d\n",y,m,d);
}
0