結果

問題 No.653 E869120 and Lucky Numbers
ユーザー 0w10w1
提出日時 2018-04-07 17:00:45
言語 Ruby
(3.3.0)
結果
AC  
実行時間 92 ms / 2,000 ms
コード長 871 bytes
コンパイル時間 39 ms
コンパイル使用メモリ 11,180 KB
実行使用メモリ 16,124 KB
最終ジャッジ日時 2023-10-11 19:27:32
合計ジャッジ時間 4,176 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 82 ms
15,168 KB
testcase_01 AC 85 ms
15,148 KB
testcase_02 AC 84 ms
15,308 KB
testcase_03 AC 85 ms
15,152 KB
testcase_04 AC 83 ms
15,088 KB
testcase_05 AC 83 ms
15,172 KB
testcase_06 AC 83 ms
15,260 KB
testcase_07 AC 81 ms
15,164 KB
testcase_08 AC 86 ms
15,104 KB
testcase_09 AC 83 ms
15,108 KB
testcase_10 AC 81 ms
15,024 KB
testcase_11 AC 81 ms
15,112 KB
testcase_12 AC 81 ms
15,144 KB
testcase_13 AC 81 ms
15,248 KB
testcase_14 AC 81 ms
15,264 KB
testcase_15 AC 82 ms
15,236 KB
testcase_16 AC 80 ms
15,276 KB
testcase_17 AC 80 ms
15,144 KB
testcase_18 AC 81 ms
15,212 KB
testcase_19 AC 83 ms
15,240 KB
testcase_20 AC 81 ms
15,176 KB
testcase_21 AC 82 ms
15,264 KB
testcase_22 AC 82 ms
15,312 KB
testcase_23 AC 81 ms
15,236 KB
testcase_24 AC 83 ms
15,280 KB
testcase_25 AC 82 ms
15,244 KB
testcase_26 AC 82 ms
15,320 KB
testcase_27 AC 82 ms
15,188 KB
testcase_28 AC 92 ms
16,124 KB
testcase_29 AC 92 ms
15,956 KB
testcase_30 AC 91 ms
16,024 KB
testcase_31 AC 82 ms
15,096 KB
testcase_32 AC 84 ms
15,244 KB
testcase_33 AC 83 ms
15,140 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 && i > 0
        cin = 0
        one = true
      else
        ng = true
      end
    when 7
      if i > 0 
        cin = 0
        one = true
      else
        ng = true
      end
    when 8
      if cin == 1 && i > 0
        cin = 0
        one = true
      else
        ng = true
      end
    else
      ng = true
    end
  end
end
ng ||= cin > 0
puts [:Yes, :No][ng ? 1 : 0]
0