結果
| 問題 |
No.7 プライムナンバーゲーム
|
| コンテスト | |
| ユーザー |
しらゆき
|
| 提出日時 | 2015-11-24 21:17:56 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 699 bytes |
| コンパイル時間 | 959 ms |
| コンパイル使用メモリ | 103,808 KB |
| 実行使用メモリ | 21,632 KB |
| 最終ジャッジ日時 | 2024-09-13 17:21:28 |
| 合計ジャッジ時間 | 7,663 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 2 TLE * 1 -- * 14 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
using System;
class Program
{
static void Main()
{
int n = int.Parse(Console.ReadLine());
if (Judge(n)) Console.WriteLine("Win");
else Console.WriteLine("Lose");
}
static bool Judge(int a)
{
bool b = false;
if (a == 0 || a == 1) b = true;
for(int i=2;i<= a; i++)
{
if (IsPrime(i) && Judge(a - i) == false) b = true;
}
return b;
}
static bool IsPrime(int a)
{
bool b = true;
for (int i=2;i*i<= a; i++)
{
if (a % i == 0)
{
b = false;
break;
}
}
return b;
}
}
しらゆき