結果
問題 | No.2109 Special Week |
ユーザー |
|
提出日時 | 2024-03-20 09:31:08 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 19 ms / 2,000 ms |
コード長 | 757 bytes |
コンパイル時間 | 3,480 ms |
コンパイル使用メモリ | 250,192 KB |
最終ジャッジ日時 | 2025-02-20 08:00:37 |
ジャッジサーバーID (参考情報) |
judge1 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 37 |
ソースコード
#include <bits/stdc++.h> #include <atcoder/all> using namespace std; using namespace atcoder; using ll = long long; int M, D, K; int months[12] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12}; int days[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; int cnt[10]; int main() { cin >> M >> D >> K; int m, d; for (int i = 0; i < 7; i++) { m = months[M - 1], d = D + i; if (days[M - 1] < d) { m = months[M % 12]; d = d - days[M - 1]; } char mmdd[5]; sprintf(mmdd, "%02d%02d", m, d); //cout << mmdd << endl; for (int j = 0; j < 4; j++) { cnt[mmdd[j] - '0']++; } } int res = 0; for (int i = 0; i < 10; i++) { if (cnt[i] > 0) res++; } cout << (res >= K ? "Yes": "No") << endl; return 0; }