結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 79 ms
15,128 KB
testcase_01 AC 82 ms
15,348 KB
testcase_02 AC 82 ms
15,144 KB
testcase_03 AC 82 ms
15,136 KB
testcase_04 AC 81 ms
15,136 KB
testcase_05 AC 80 ms
15,328 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 84 ms
15,260 KB
testcase_09 AC 80 ms
15,340 KB
testcase_10 AC 78 ms
15,148 KB
testcase_11 AC 78 ms
15,072 KB
testcase_12 AC 78 ms
15,312 KB
testcase_13 AC 78 ms
15,292 KB
testcase_14 WA -
testcase_15 AC 78 ms
15,268 KB
testcase_16 WA -
testcase_17 AC 79 ms
15,204 KB
testcase_18 AC 79 ms
15,184 KB
testcase_19 AC 79 ms
15,280 KB
testcase_20 AC 78 ms
15,340 KB
testcase_21 AC 78 ms
15,044 KB
testcase_22 AC 77 ms
15,264 KB
testcase_23 AC 77 ms
15,352 KB
testcase_24 AC 79 ms
15,180 KB
testcase_25 AC 79 ms
15,324 KB
testcase_26 AC 78 ms
15,268 KB
testcase_27 AC 78 ms
15,296 KB
testcase_28 AC 88 ms
16,064 KB
testcase_29 AC 89 ms
15,972 KB
testcase_30 AC 89 ms
16,108 KB
testcase_31 AC 79 ms
15,324 KB
testcase_32 AC 79 ms
15,292 KB
testcase_33 AC 79 ms
15,068 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

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]
0