結果
| 問題 | No.653 E869120 and Lucky Numbers | 
| コンテスト | |
| ユーザー |  rsk0315 | 
| 提出日時 | 2019-01-07 01:55:48 | 
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 4 ms / 2,000 ms | 
| コード長 | 558 bytes | 
| コンパイル時間 | 381 ms | 
| コンパイル使用メモリ | 55,936 KB | 
| 最終ジャッジ日時 | 2025-01-06 20:13:19 | 
| ジャッジサーバーID (参考情報) | judge2 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 31 | 
コンパイルメッセージ
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);
      |   ~~~~~^~~~~~~~~~~
            
            ソースコード
#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;
  bool pop = false;
  while (p.length() > 1) {
    int b = p.back();
    if (!('2' <= b && b <= '4')) break;
    p.pop_back();
    pop = true;
    --p.back();
  }
  if (p == "0") return puts("Yes"), 0;
  if (!pop) return puts("No"), 0;
  fprintf(stderr, "> %s\n", p.c_str());
  for (int ch: p)
    if (!(ch == '6' || ch == '7'))
      return puts("No"), 0;
  puts("Yes");
}
            
            
            
        