結果

問題 No.2109 Special Week
ユーザー a
提出日時 2022-10-28 21:26:59
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 3 ms / 2,000 ms
コード長 888 bytes
コンパイル時間 2,259 ms
コンパイル使用メモリ 202,916 KB
最終ジャッジ日時 2025-02-08 14:01:52
ジャッジサーバーID
(参考情報)
judge5 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 37
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    vector<int> v = {-1, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
    int M, D, K;
    cin >> M >> D >> K;
    set<char> st;
    for (int i = 0; i < 7; i++) {
        string S = to_string(M);
        string T = to_string(D);
        if ((int)(S.size()) == 1) {
            S = '0' + S;
        }
        if ((int)(T.size()) == 1) {
            T = '0' + T;
        }
        st.insert(S[0]);
        st.insert(S[1]);
        st.insert(T[0]);
        st.insert(T[1]);
        if (D == v[M]) {
            D = 1;
            M++;
            if (M == 13) {
                M = 1;
            }
        } else {
            D++;
        }
    }
    if ((int)(st.size()) >= K) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    return 0;
}
0