結果
問題 | No.2109 Special Week |
ユーザー |
![]() |
提出日時 | 2022-10-28 21:53:42 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 702 bytes |
コンパイル時間 | 1,532 ms |
コンパイル使用メモリ | 170,152 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-07-06 01:00:24 |
合計ジャッジ時間 | 2,339 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 37 |
ソースコード
#include <bits/stdc++.h> using namespace std; const int month[13] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; int main() { int m, d, k; cin >> m >> d >> k; vector<bool> v(10); int nm = m; int nd = d; for(int i = 0; i < 7; i++) { if(nm <= 9) { v[0] = true; v[nm] = true; } else { v[1] = true; v[nm % 10] = true; } if(nd <= 9) { v[0] = true; v[nd] = true; } else { v[nd / 10] = true; v[nd % 10] = true; } nd++; if(month[nm] < nd) { nd = 1; nm++; if(nm == 13) nm = 1; } } int ans = 0; for(int i = 0; i < 10; i++) if(v[i]) ans++; if(k <= ans) cout << "Yes" << endl; else cout << "No" << endl; return 0; }