結果

問題 No.653 E869120 and Lucky Numbers
ユーザー 0w10w1
提出日時 2018-04-07 16:50:47
言語 Ruby
(3.3.0)
結果
WA  
実行時間 -
コード長 358 bytes
コンパイル時間 273 ms
コンパイル使用メモリ 11,200 KB
実行使用メモリ 16,356 KB
最終ジャッジ日時 2023-09-08 18:13:30
合計ジャッジ時間 4,573 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 79 ms
15,284 KB
testcase_01 AC 83 ms
15,172 KB
testcase_02 AC 82 ms
15,116 KB
testcase_03 AC 83 ms
15,200 KB
testcase_04 AC 81 ms
15,368 KB
testcase_05 AC 82 ms
15,156 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 83 ms
15,372 KB
testcase_09 WA -
testcase_10 AC 79 ms
15,292 KB
testcase_11 AC 78 ms
15,184 KB
testcase_12 AC 79 ms
15,200 KB
testcase_13 WA -
testcase_14 AC 79 ms
15,316 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 AC 78 ms
15,328 KB
testcase_18 AC 79 ms
15,108 KB
testcase_19 AC 78 ms
15,176 KB
testcase_20 AC 79 ms
15,204 KB
testcase_21 AC 79 ms
15,116 KB
testcase_22 AC 78 ms
15,148 KB
testcase_23 AC 78 ms
15,104 KB
testcase_24 AC 79 ms
15,060 KB
testcase_25 AC 79 ms
15,112 KB
testcase_26 AC 78 ms
15,148 KB
testcase_27 AC 79 ms
15,320 KB
testcase_28 WA -
testcase_29 WA -
testcase_30 AC 88 ms
16,252 KB
testcase_31 AC 79 ms
15,204 KB
testcase_32 AC 78 ms
15,160 KB
testcase_33 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

s = gets.strip.chars.map &:to_i
ng = false
cin = 0
s.reverse.each.with_index do |c, i|
  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
  else
    ng = true
  end
end
ng ||= cin > 0
puts [:Yes, :No][ng ? 1 : 0]
0