結果

問題 No.653 E869120 and Lucky Numbers
ユーザー simansiman
提出日時 2023-01-12 19:31:37
言語 Ruby
(3.3.0)
結果
AC  
実行時間 87 ms / 2,000 ms
コード長 697 bytes
コンパイル時間 312 ms
コンパイル使用メモリ 11,256 KB
実行使用メモリ 15,976 KB
最終ジャッジ日時 2023-08-25 01:08:08
合計ジャッジ時間 4,384 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 80 ms
15,136 KB
testcase_01 AC 77 ms
15,136 KB
testcase_02 AC 76 ms
15,088 KB
testcase_03 AC 76 ms
15,116 KB
testcase_04 AC 76 ms
15,136 KB
testcase_05 AC 75 ms
15,204 KB
testcase_06 AC 76 ms
15,124 KB
testcase_07 AC 76 ms
15,092 KB
testcase_08 AC 78 ms
15,320 KB
testcase_09 AC 75 ms
15,164 KB
testcase_10 AC 76 ms
15,088 KB
testcase_11 AC 75 ms
15,248 KB
testcase_12 AC 74 ms
15,092 KB
testcase_13 AC 76 ms
15,180 KB
testcase_14 AC 76 ms
15,280 KB
testcase_15 AC 76 ms
15,084 KB
testcase_16 AC 77 ms
15,088 KB
testcase_17 AC 77 ms
15,192 KB
testcase_18 AC 75 ms
15,116 KB
testcase_19 AC 76 ms
15,308 KB
testcase_20 AC 76 ms
15,128 KB
testcase_21 AC 75 ms
15,256 KB
testcase_22 AC 76 ms
15,088 KB
testcase_23 AC 76 ms
15,168 KB
testcase_24 AC 75 ms
15,044 KB
testcase_25 AC 76 ms
15,240 KB
testcase_26 AC 75 ms
15,196 KB
testcase_27 AC 76 ms
15,120 KB
testcase_28 AC 87 ms
15,976 KB
testcase_29 AC 86 ms
15,864 KB
testcase_30 AC 85 ms
15,796 KB
testcase_31 AC 77 ms
15,312 KB
testcase_32 AC 76 ms
15,044 KB
testcase_33 AC 76 ms
15,000 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 || v == 7 || v == 8
      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