結果

問題 No.2109 Special Week
ユーザー tnakao0123
提出日時 2022-10-29 18:48:52
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 732 bytes
コンパイル時間 219 ms
コンパイル使用メモリ 41,984 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-07-06 16:04:43
合計ジャッジ時間 1,209 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 37
権限があれば一括ダウンロードができます

ソースコード

diff #

/* -*- coding: utf-8 -*-
 *
 * 2109.cc:  No.2109 Special Week - yukicoder
 */

#include<cstdio>
#include<algorithm>
 
using namespace std;

/* constant */

const int MOY = 12;
const int W = 7;
const int doms[] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };

/* typedef */

/* global variables */

bool used[10];

/* subroutines */

inline void check(int x) { used[x / 10] = used[x % 10] = true; }

/* main */

int main() {
  int m, d, k;
  scanf("%d%d%d", &m, &d, &k);
  m--;

  for (int i = 0; i < W; i++) {
    check(m + 1), check(d);
    if (++d > doms[m])
      m = (m + 1) % MOY, d = 1;
  }

  int c = 0;
  for (int i = 0; i < 10; i++)
    if (used[i]) c++;

  if (c >= k) puts("Yes");
  else puts("No");

  return 0;
}
0