結果

問題 No.7 プライムナンバーゲーム
ユーザー simansiman
提出日時 2016-03-22 00:11:22
言語 Ruby
(3.3.0)
結果
AC  
実行時間 815 ms / 5,000 ms
コード長 358 bytes
コンパイル時間 272 ms
コンパイル使用メモリ 7,680 KB
実行使用メモリ 13,056 KB
最終ジャッジ日時 2024-04-09 03:57:13
合計ジャッジ時間 7,651 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 102 ms
12,288 KB
testcase_01 AC 101 ms
12,416 KB
testcase_02 AC 815 ms
12,928 KB
testcase_03 AC 149 ms
12,800 KB
testcase_04 AC 114 ms
12,672 KB
testcase_05 AC 112 ms
12,672 KB
testcase_06 AC 316 ms
12,672 KB
testcase_07 AC 245 ms
12,800 KB
testcase_08 AC 168 ms
12,800 KB
testcase_09 AC 422 ms
12,800 KB
testcase_10 AC 104 ms
12,288 KB
testcase_11 AC 247 ms
12,672 KB
testcase_12 AC 617 ms
12,800 KB
testcase_13 AC 646 ms
12,800 KB
testcase_14 AC 814 ms
12,928 KB
testcase_15 AC 777 ms
13,056 KB
testcase_16 AC 733 ms
12,800 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

require 'prime'

class Yukicoder
  def initialize
    n = gets.chomp.to_i
    result = Hash.new(false)

    3.upto(n) do |i|
      Prime.each(i) do |j|
        if (i - j) > 1 && !result[i-j]
          result[i] = true
          break
        end
      end
    end

    if result[n]
      puts "Win"
    else
      puts "Lose"
    end
  end
end

Yukicoder.new
0