結果

問題 No.2109 Special Week
ユーザー srjywrdnprktsrjywrdnprkt
提出日時 2023-05-05 17:23:37
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 797 bytes
コンパイル時間 1,011 ms
コンパイル使用メモリ 107,472 KB
最終ジャッジ日時 2025-02-12 17:15:50
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 37
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <cmath>
#include <map>
#include <set>
#include <iomanip>
#include <queue>
#include <algorithm>
#include <numeric>
#include <deque>
#include <complex>
#include <cassert>

using namespace std;
using ll = long long;

int main(){

    vector<int> a = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}, cnt(10);
    int M, D, K, x, y;
    cin >> M >> D >> K;
    for (int i=0; i<7; i++){
        x = M / 10; y = M % 10;
        cnt[x]++; cnt[y]++;
        x = D / 10; y = D % 10;
        cnt[x]++; cnt[y]++;
        D++;
        if (D > a[M]){
            D = 1;
            M++;
            if (M == 13) M = 1;
        }
    }

    for (int i=0; i<=9; i++){
        if (cnt[i]) K--;
    }

    cout << (K <= 0 ? "Yes" : "No") << endl;

    return 0;
}
0