結果

問題 No.721 Die tertia (ディエ・テルツィア)
ユーザー NoiriNoiri
提出日時 2024-01-13 16:38:14
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,178 bytes
コンパイル時間 1,687 ms
コンパイル使用メモリ 169,580 KB
実行使用メモリ 6,676 KB
最終ジャッジ日時 2024-01-13 16:38:17
合計ジャッジ時間 2,704 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h>

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

using namespace std;
using ll = long long;

int C2I(char c){
    int ret = c - '0';
    return ret;
}

int main(){
    string yymmdd;
    cin >> yymmdd;
    int y = C2I(yymmdd[0]) * 1000 + C2I(yymmdd[1]) * 100 + C2I(yymmdd[2]) * 10 + C2I(yymmdd[3]);
    int m = C2I(yymmdd[5]) * 10 + C2I(yymmdd[6]);
    int d = C2I(yymmdd[8]) * 10 + C2I(yymmdd[9]);

    vector<int> days = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
    // 閏年を考慮
    if(y % 4 == 0){
        days[1] = 29;
    }
    else{
        days[1] = 28;
    }

    d += 2;
    if(d > days[m-1]){
        d = d - days[m-1];
        m++;
    }
    if(m > 12){
        m = 1;
        y++;
    }

    cout << y << "/";
    if(m < 10) cout << "0" << m << "/";
    if(d < 10) cout << "0" << d << endl;
}
0