結果
問題 |
No.726 Tree Game
|
ユーザー |
|
提出日時 | 2018-08-30 11:51:37 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 566 bytes |
コンパイル時間 | 207 ms |
コンパイル使用メモリ | 22,656 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-09-13 19:48:48 |
合計ジャッジ時間 | 926 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 18 WA * 7 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:11:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 11 | scanf("%d %d",&Y,&X); | ~~~~~^~~~~~~~~~~~~~~
ソースコード
#include <stdio.h> int Y,X; char isPrime(int a){ if(a == 2) return 1; for(int k = 2; k*k <= a; k++) if(a%k==0) return 1; return 0; } int main(){ scanf("%d %d",&Y,&X); int cnt = 0; if(isPrime(X)==1){ cnt += 0; }else{ for(int y = Y+1; isPrime(y) != 0; y++) cnt++; } if(isPrime(Y)==1){ cnt += 0; }else{ for(int x = X+1; isPrime(x) != 0; x++) cnt++; } printf((cnt%2)?"First\n":"Second\n"); }