結果

問題 No.653 E869120 and Lucky Numbers
ユーザー simansiman
提出日時 2023-01-12 19:28:20
言語 Ruby
(3.3.0)
結果
WA  
実行時間 -
コード長 681 bytes
コンパイル時間 87 ms
コンパイル使用メモリ 11,332 KB
実行使用メモリ 15,992 KB
最終ジャッジ日時 2023-08-25 01:06:41
合計ジャッジ時間 4,570 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 78 ms
15,152 KB
testcase_01 AC 81 ms
15,304 KB
testcase_02 AC 83 ms
15,140 KB
testcase_03 AC 82 ms
15,036 KB
testcase_04 AC 82 ms
15,088 KB
testcase_05 AC 88 ms
15,288 KB
testcase_06 AC 83 ms
15,312 KB
testcase_07 WA -
testcase_08 AC 82 ms
15,224 KB
testcase_09 WA -
testcase_10 AC 78 ms
15,160 KB
testcase_11 WA -
testcase_12 AC 79 ms
15,108 KB
testcase_13 WA -
testcase_14 AC 78 ms
15,136 KB
testcase_15 AC 79 ms
15,120 KB
testcase_16 AC 79 ms
15,240 KB
testcase_17 AC 82 ms
15,160 KB
testcase_18 AC 78 ms
15,340 KB
testcase_19 AC 79 ms
15,272 KB
testcase_20 AC 80 ms
15,116 KB
testcase_21 AC 81 ms
15,044 KB
testcase_22 AC 79 ms
15,188 KB
testcase_23 WA -
testcase_24 AC 81 ms
15,108 KB
testcase_25 AC 79 ms
15,112 KB
testcase_26 AC 78 ms
15,128 KB
testcase_27 AC 78 ms
15,052 KB
testcase_28 AC 90 ms
15,740 KB
testcase_29 AC 90 ms
15,988 KB
testcase_30 AC 90 ms
15,992 KB
testcase_31 AC 81 ms
15,284 KB
testcase_32 WA -
testcase_33 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

P = gets.chomp.chars.map(&:to_i)
N = P.size - 1

single_flg = false

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

puts "Yes"
0