結果

問題 No.2109 Special Week
ユーザー risujirohrisujiroh
提出日時 2022-10-28 21:52:01
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 697 bytes
コンパイル時間 3,543 ms
コンパイル使用メモリ 252,040 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-07-06 00:57:42
合計ジャッジ時間 3,519 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 37
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

void solve(std::istream& is, std::ostream& os) {
  std::array const days = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
  int M, D, K;
  is >> M >> D >> K;
  std::stringstream ss;
  for (int _ = 7; _--;) {
    ss << std::setw(2) << std::setfill('0') << M;
    ss << std::setw(2) << std::setfill('0') << D;
    if (D == days[M]) {
      D = 1;
      if (M == 12) {
        M = 1;
      } else {
        ++M;
      }
    } else {
      ++D;
    }
  }
  std::string s = ss.str();
  os << (K <= int(std::set(s.begin(), s.end()).size()) ? "Yes\n" : "No\n");
}

int main() {
  std::ios::sync_with_stdio(false);
  std::cin.tie(nullptr);

  solve(std::cin, std::cout);
}
0