結果
| 問題 | No.653 E869120 and Lucky Numbers | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2018-09-14 22:35:13 | 
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                WA
                                 
                             | 
| 実行時間 | - | 
| コード長 | 883 bytes | 
| コンパイル時間 | 1,648 ms | 
| コンパイル使用メモリ | 195,928 KB | 
| 最終ジャッジ日時 | 2025-01-06 13:23:07 | 
| ジャッジサーバーID (参考情報) | judge2 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 28 WA * 3 | 
ソースコード
#include <bits/stdc++.h>
#define show(x) std::cerr << #x << " = " << x << std::endl
int main()
{
    std::string s;
    std::cin >> s;
    const int sz = s.size();
    std::vector<int> p;
    for (const char c : s) { p.push_back(c - '0'); }
    std::reverse(p.begin(), p.end());
    auto in = [](const int target, const int inf, const int sup) { return inf <= target and target <= sup; };
    auto judge = [&]() {
        if (not in(p[0], 2, 4)) { return false; }
        int pos = 1;
        for (; pos < sz and in(p[pos], 3, 5); pos++) {}
        if (pos == sz) { return false; }
        if (p[pos] == 1) {
            return pos == sz - 1;
        } else if (not in(p[pos], 7, 8)) {
            return false;
        }
        for (; pos < sz and in(p[pos], 6, 7); pos++) {}
        return pos == sz;
    };
    std::cout << (judge() ? "Yes" : "No") << std::endl;
    return 0;
}
            
            
            
        