結果

問題 No.653 E869120 and Lucky Numbers
ユーザー nebukuro09
提出日時 2018-02-23 22:53:28
言語 D
(dmd 2.109.1)
結果
WA  
実行時間 -
コード長 651 bytes
コンパイル時間 692 ms
コンパイル使用メモリ 114,260 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-06-12 23:54:43
合計ジャッジ時間 1,837 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 25 WA * 6
権限があれば一括ダウンロードができます

ソースコード

diff #

import std.stdio, std.array, std.string, std.conv, std.algorithm;
import std.typecons, std.range, std.random, std.math, std.container;
import std.numeric, std.bigint, core.bitop, std.bitmanip;

void main() {
    auto P = readln.chomp.map!(c => (c - '0').to!int).array;
    P.reverse();
    int N = P.length.to!int;
    if (N == 1) {
        writeln("No");
        return;
    }

    foreach (i; 0..N) {
        if (i == 0 && P[i] >= 2 && P[i] <= 4) continue;
        else if (i >= 1 && i < N - 1 && P[i] >= 3 && P[i] <= 5) continue;
        else if (i == N-1 && P[i] == 1) continue;
        writeln("No");
        return;
    }

    writeln("Yes");
}
0