結果

問題 No.7 プライムナンバーゲーム
ユーザー kwnwsdnc
提出日時 2018-03-30 18:56:12
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 776 bytes
コンパイル時間 1,023 ms
コンパイル使用メモリ 12,416 KB
実行使用メモリ 78,464 KB
最終ジャッジ日時 2024-06-26 00:42:58
合計ジャッジ時間 6,486 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 9 WA * 8
権限があれば一括ダウンロードができます

ソースコード

diff #

def game(N):
    prime=[]
    for i in range(2,10000):
        judge=0
        for j in range(2,100):
            if i==j:
                break
            if i%j==0 :
                judge+=1
                break
        if judge==0:
            prime.append(i)


    Q=[[0]]
    have=[0 for i in range(20000)]
    for i in range(10000):
        for q in Q[i]:
            Q.append([])
            for p in prime:
                if  p+q>10000:
                    break
                if have[q+p]==0:
                    Q[i+1].append(q+p)
                    if p+q==N:
                        if i%2==0:
                            return "Win"
                        else:
                            return"Lose"

N=int(input())
print(game(N))
                
    
0