結果

問題 No.7 プライムナンバーゲーム
ユーザー LaLa
提出日時 2020-11-24 18:36:41
言語 Ruby
(3.3.0)
結果
AC  
実行時間 354 ms / 5,000 ms
コード長 440 bytes
コンパイル時間 345 ms
コンパイル使用メモリ 7,680 KB
実行使用メモリ 12,928 KB
最終ジャッジ日時 2024-04-09 05:00:57
合計ジャッジ時間 7,841 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 342 ms
12,800 KB
testcase_01 AC 337 ms
12,544 KB
testcase_02 AC 345 ms
12,672 KB
testcase_03 AC 342 ms
12,928 KB
testcase_04 AC 340 ms
12,800 KB
testcase_05 AC 337 ms
12,800 KB
testcase_06 AC 343 ms
12,800 KB
testcase_07 AC 342 ms
12,672 KB
testcase_08 AC 347 ms
12,544 KB
testcase_09 AC 354 ms
12,544 KB
testcase_10 AC 341 ms
12,672 KB
testcase_11 AC 342 ms
12,544 KB
testcase_12 AC 340 ms
12,800 KB
testcase_13 AC 343 ms
12,544 KB
testcase_14 AC 348 ms
12,544 KB
testcase_15 AC 337 ms
12,928 KB
testcase_16 AC 344 ms
12,544 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

require 'prime'
ss=Prime.each(10000).to_a
ans=Array.new(10001)
n=gets.to_i

(10000+1).times do |d|
    if(d<2)
        ans[d]=true
    elsif(d<4)
        ans[d]=false
    else
        f=0
        ss.each do |p|
            break if(p>d)
            if(ans[d-p]==false)
                ans[d]=true
                f=1
                break 
            end
        end
        ans[d]=false unless(f==1)
    end
end

puts ans[n]? "Win":"Lose"
0