結果

問題 No.653 E869120 and Lucky Numbers
ユーザー rsk0315
提出日時 2019-01-07 01:41:40
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 445 bytes
コンパイル時間 567 ms
コンパイル使用メモリ 55,680 KB
最終ジャッジ日時 2025-01-06 20:13:06
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 25 WA * 6
権限があれば一括ダウンロードができます
コンパイルメッセージ
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((p == "6" || p == "7")? "Yes":"No"), 0;

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

  puts("Yes");
}
0