結果

問題 No.653 E869120 and Lucky Numbers
ユーザー siman
提出日時 2023-01-12 19:24:54
言語 Ruby
(3.4.1)
結果
RE  
実行時間 -
コード長 561 bytes
コンパイル時間 48 ms
コンパイル使用メモリ 7,424 KB
実行使用メモリ 13,056 KB
最終ジャッジ日時 2024-12-23 12:46:32
合計ジャッジ時間 4,255 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 17 WA * 2 RE * 12
権限があれば一括ダウンロードができます
コンパイルメッセージ
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