結果
問題 | No.2109 Special Week |
ユーザー |
![]() |
提出日時 | 2022-10-28 21:56:20 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 35 ms / 2,000 ms |
コード長 | 1,577 bytes |
コンパイル時間 | 965 ms |
コンパイル使用メモリ | 105,036 KB |
最終ジャッジ日時 | 2025-02-08 14:26:59 |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 37 |
ソースコード
#include <algorithm>#include <cmath>#include <iomanip>#include <iostream>#include <map>#include <queue>#include <set>#include <string>#include <tuple>#include <vector>#define mkp make_pair#define mkt make_tuple#define rep(i, n) for (int i = 0; i < (int)(n); ++i)#define all(v) v.begin(), v.end()using namespace std;typedef long long ll;const ll MOD = 1e9 + 7;// const ll MOD = 998244353;template <class T>void chmin(T &a, const T &b) {if (a > b) a = b;}template <class T>void chmax(T &a, const T &b) {if (a < b) a = b;}void solve() {int M, D, K;cin >> M >> D >> K;vector<int> cnt(10, 0);auto advance_day = [](int &M, int &D) -> void {if (M == 2 && D == 28) {M++;D = 1;} else if ((M == 4 || M == 6 || M == 9 || M == 11) && D == 30) {M++;D = 1;} else if ((M == 1 || M == 3 || M == 5 || M == 7 || M == 8 || M == 10 || M == 12) &&D == 31) {M++;if (M == 13) M = 1;D = 1;} else {D++;}};auto count = [&](int M, int D) -> void {cnt[M % 10]++;cnt[M / 10]++;cnt[D % 10]++;cnt[D / 10]++;};rep(k, 7) {count(M, D);advance_day(M, D);}int type = 0;rep(i, 10) if (cnt[i] > 0) type++;if (type >= K)cout << "Yes" << endl;elsecout << "No" << endl;}int main() {cin.tie(nullptr);ios::sync_with_stdio(false);solve();return 0;}