結果

問題 No.653 E869120 and Lucky Numbers
ユーザー rsk0315
提出日時 2019-01-07 01:48:48
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 520 bytes
コンパイル時間 415 ms
コンパイル使用メモリ 56,192 KB
最終ジャッジ日時 2025-01-06 20:13:10
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 29 WA * 2
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:7:8: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    7 |   scanf("%s", buf);
      |   ~~~~~^~~~~~~~~~~

ソースコード

diff #

#include <cstdio>
#include <cstdint>
#include <string>

int main() {
  char buf[32768];
  scanf("%s", buf);
  std::string p = buf;
  if (p.length() == 1)
    return puts("No"), 0;

  while (p.length() > 2) {
    int b = p.back() - '0';
    if (!(2 <= b && b <= 4)) break;
    p.pop_back();
    --p.back();
  }
  if (p == "12" || p == "13" || p == "14")
    return puts("Yes"), 0;

  fprintf(stderr, "> %s\n", p.c_str());
  for (int ch: p)
    if (!(ch == '6' || ch == '7'))
      return puts("No"), 0;

  puts("Yes");
}
0