結果
問題 | No.653 E869120 and Lucky Numbers |
ユーザー |
|
提出日時 | 2018-02-23 23:03:42 |
言語 | D (dmd 2.109.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,004 bytes |
コンパイル時間 | 695 ms |
コンパイル使用メモリ | 114,268 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-06-12 23:54:47 |
合計ジャッジ時間 | 1,532 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 29 WA * 2 |
ソースコード
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 || P[0] <= 1 || P[0] >= 5) {writeln("No");return;}bool owari1 = false;bool owari2 = false;foreach (i; 1..N) {if (owari2) {writeln("No");return;} else if (owari1) {if (P[i] != 6 && P[i] != 7) {writeln("No");return;}} else {if (P[i] == 1) {owari2 = true;} else if (P[i] == 7 || P[i] == 8) {owari1 = true;} else if (P[i] <= 2 || P[i] >= 6) {writeln("No");return;}}}writeln("Yes");}