結果
| 問題 |
No.7 プライムナンバーゲーム
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2014-11-25 01:03:28 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 318 bytes |
| コンパイル時間 | 256 ms |
| コンパイル使用メモリ | 27,776 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2025-01-02 21:18:25 |
| 合計ジャッジ時間 | 1,124 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 7 WA * 10 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:13:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
13 | scanf("%d",&n);
| ~~~~~^~~~~~~~~
ソースコード
#include <stdio.h>
#define M 10000
int table[M+1],result[M+1];
int main(){
int i,j,n;
table[0]=table[1]=result[0]=result[1]=1;
for(i=2;i<=M;i++)if(!table[i]){
for(j=2*i;j<=M;j+=i)table[j]=1;
for(j=i;result[j-i];j++);
result[j]=1;
}
scanf("%d",&n);
puts(result[n]?"Win":"Lose");
return 0;
}