結果

問題 No.721 Die tertia (ディエ・テルツィア)
ユーザー rogi52rogi52
提出日時 2022-09-26 16:45:11
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 11 ms / 2,000 ms
コード長 1,018 bytes
コンパイル時間 2,060 ms
コンパイル使用メモリ 208,168 KB
実行使用メモリ 7,532 KB
最終ジャッジ日時 2023-08-24 02:55:21
合計ジャッジ時間 3,862 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 11 ms
5,952 KB
testcase_01 AC 11 ms
6,212 KB
testcase_02 AC 10 ms
6,212 KB
testcase_03 AC 10 ms
6,140 KB
testcase_04 AC 10 ms
6,816 KB
testcase_05 AC 11 ms
7,532 KB
testcase_06 AC 10 ms
5,960 KB
testcase_07 AC 10 ms
6,208 KB
testcase_08 AC 11 ms
6,264 KB
testcase_09 AC 10 ms
7,212 KB
testcase_10 AC 11 ms
6,096 KB
testcase_11 AC 10 ms
6,264 KB
testcase_12 AC 11 ms
7,476 KB
testcase_13 AC 10 ms
6,740 KB
testcase_14 AC 11 ms
6,144 KB
testcase_15 AC 11 ms
6,144 KB
testcase_16 AC 10 ms
6,020 KB
testcase_17 AC 11 ms
6,136 KB
testcase_18 AC 10 ms
6,740 KB
testcase_19 AC 10 ms
6,268 KB
testcase_20 AC 11 ms
7,256 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(0);
    
    auto f = [](int y) {
        if(y % 4 != 0) return false;
        if(y % 400 == 0) return true;
        if(y % 100 == 0) return false;
        return true;
    };

    int nd[] = {-int(1e9), 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
    using T = tuple<int,int,int>;
    vector< T > a;
    for(int y = 2000; y <= 2401; y++) {
        for(int m = 1; m <= 12; m++) {
            for(int d = 1; d <= nd[m]; d++) {
                a.push_back(T{y, m, d});
            }
        }
        if(f(y)) a.push_back(T{y, 2, 29});
    }

    sort(a.begin(), a.end());
    int y,m,d; char c; cin >> y >> c >> m >> c >> d;
    T now = {y, m, d};
    for(int i = 0; i < int(a.size()); i++) {
        if(a[i] == now) {
            auto [y, m, d] = a[i + 2];
            printf("%04d/%02d/%02d\n", y, m, d);
            return 0;
        }
    }
}
0