結果
| 問題 | No.653 E869120 and Lucky Numbers |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2018-04-07 16:55:28 |
| 言語 | Ruby (4.0.2) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 752 bytes |
| 記録 | |
| コンパイル時間 | 121 ms |
| コンパイル使用メモリ | 8,960 KB |
| 実行使用メモリ | 15,872 KB |
| 最終ジャッジ日時 | 2026-03-13 03:56:18 |
| 合計ジャッジ時間 | 3,086 ms |
|
ジャッジサーバーID (参考情報) |
judge1_1 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 27 WA * 4 |
コンパイルメッセージ
Syntax OK
ソースコード
s = gets.strip.chars.map &:to_i
ng = false
cin = 0
one = false
s.reverse.each.with_index do |c, i|
if one
ng = true if c != 6 && c != 7
else
case c
when 1
if cin == 1 && i + 1 == s.size
cin = 0
else
ng = true
end
when 2
if cin == 0
cin = 1
else
ng = true
end
when 3..4
cin = 1
when 5
if cin == 1
cin = 1
else
ng = true
end
when 6
if cin == 0
cin = 0
one = true
else
ng = true
end
when 7
if cin == 1
cin = 0
one = true
else
ng = true
end
else
ng = true
end
end
end
ng ||= cin > 0
puts [:Yes, :No][ng ? 1 : 0]