結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 83 ms
15,060 KB
testcase_01 AC 81 ms
15,172 KB
testcase_02 AC 79 ms
15,252 KB
testcase_03 AC 80 ms
15,240 KB
testcase_04 AC 81 ms
15,404 KB
testcase_05 AC 80 ms
15,244 KB
testcase_06 AC 82 ms
15,296 KB
testcase_07 WA -
testcase_08 AC 81 ms
15,368 KB
testcase_09 AC 81 ms
15,296 KB
testcase_10 AC 79 ms
15,264 KB
testcase_11 AC 80 ms
15,296 KB
testcase_12 AC 78 ms
15,040 KB
testcase_13 AC 77 ms
15,248 KB
testcase_14 AC 78 ms
15,352 KB
testcase_15 AC 78 ms
15,300 KB
testcase_16 AC 78 ms
15,172 KB
testcase_17 AC 78 ms
15,300 KB
testcase_18 AC 78 ms
15,124 KB
testcase_19 AC 78 ms
15,308 KB
testcase_20 AC 77 ms
15,144 KB
testcase_21 AC 79 ms
15,164 KB
testcase_22 AC 78 ms
15,296 KB
testcase_23 AC 78 ms
15,032 KB
testcase_24 AC 77 ms
15,292 KB
testcase_25 AC 78 ms
15,344 KB
testcase_26 AC 77 ms
15,032 KB
testcase_27 AC 77 ms
15,296 KB
testcase_28 AC 88 ms
15,728 KB
testcase_29 AC 87 ms
15,876 KB
testcase_30 AC 87 ms
15,884 KB
testcase_31 AC 78 ms
15,176 KB
testcase_32 AC 77 ms
15,320 KB
testcase_33 AC 78 ms
15,292 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

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

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