結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 82 ms
15,312 KB
testcase_01 AC 81 ms
15,164 KB
testcase_02 AC 80 ms
15,320 KB
testcase_03 AC 83 ms
15,136 KB
testcase_04 AC 83 ms
15,256 KB
testcase_05 AC 82 ms
15,064 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 83 ms
15,364 KB
testcase_09 AC 80 ms
15,196 KB
testcase_10 AC 79 ms
15,284 KB
testcase_11 AC 78 ms
15,172 KB
testcase_12 AC 79 ms
15,384 KB
testcase_13 AC 79 ms
15,176 KB
testcase_14 AC 79 ms
15,172 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 AC 79 ms
15,320 KB
testcase_18 AC 78 ms
15,172 KB
testcase_19 AC 82 ms
15,376 KB
testcase_20 AC 80 ms
15,276 KB
testcase_21 AC 81 ms
15,272 KB
testcase_22 AC 80 ms
15,056 KB
testcase_23 AC 81 ms
15,272 KB
testcase_24 AC 80 ms
15,164 KB
testcase_25 AC 79 ms
15,148 KB
testcase_26 AC 78 ms
15,368 KB
testcase_27 AC 78 ms
15,364 KB
testcase_28 WA -
testcase_29 WA -
testcase_30 AC 90 ms
16,208 KB
testcase_31 AC 77 ms
15,180 KB
testcase_32 AC 78 ms
15,060 KB
testcase_33 AC 78 ms
15,192 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
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
  when 5
    if cin == 1
      cin = 1
    else
      ng = true
    end
  else
    ng = true
  end
end
ng ||= cin > 0
puts [:Yes, :No][ng ? 1 : 0]
0