結果

問題 No.653 E869120 and Lucky Numbers
ユーザー simansiman
提出日時 2023-01-12 19:24:54
言語 Ruby
(3.3.0)
結果
RE  
実行時間 -
コード長 561 bytes
コンパイル時間 256 ms
コンパイル使用メモリ 11,216 KB
実行使用メモリ 16,300 KB
最終ジャッジ日時 2023-08-25 01:04:23
合計ジャッジ時間 5,314 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 79 ms
15,128 KB
testcase_01 RE -
testcase_02 RE -
testcase_03 RE -
testcase_04 RE -
testcase_05 RE -
testcase_06 RE -
testcase_07 AC 75 ms
15,296 KB
testcase_08 RE -
testcase_09 AC 74 ms
15,300 KB
testcase_10 AC 77 ms
15,240 KB
testcase_11 AC 75 ms
15,160 KB
testcase_12 AC 75 ms
15,308 KB
testcase_13 AC 75 ms
15,132 KB
testcase_14 AC 75 ms
15,028 KB
testcase_15 RE -
testcase_16 RE -
testcase_17 AC 75 ms
15,240 KB
testcase_18 AC 76 ms
15,092 KB
testcase_19 RE -
testcase_20 AC 75 ms
15,132 KB
testcase_21 AC 75 ms
15,248 KB
testcase_22 AC 75 ms
15,128 KB
testcase_23 AC 76 ms
15,264 KB
testcase_24 AC 75 ms
15,036 KB
testcase_25 AC 75 ms
15,300 KB
testcase_26 WA -
testcase_27 WA -
testcase_28 RE -
testcase_29 RE -
testcase_30 AC 83 ms
15,832 KB
testcase_31 AC 76 ms
15,316 KB
testcase_32 AC 75 ms
15,144 KB
testcase_33 AC 74 ms
15,344 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

P = gets.chomp.chars.map(&:to_i)

single_flg = false
its_over = false

P.reverse_each.with_index do |v, idx|
  if idx == 0
    if (2..4).cover?(v)
    else
      puts "No"
      exit
    end
  elsif its_over
    puts "No"
    exit
  else
    if single_flg
      if (6..7).cover?
      else
        puts "No"
        exit
      end
    else
      if (3..5).cover?(v)
        # next
      elsif (7..8).cover?(v)
        single_flg = true
      elsif v == 1
        its_over = true
      else
        puts "No"
        exit
      end
    end
  end
end

puts "Yes"
0