結果
問題 | No.669 対決!!! 飲み比べ |
ユーザー |
![]() |
提出日時 | 2018-07-28 15:55:11 |
言語 | C++11 (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 381 bytes |
コンパイル時間 | 297 ms |
コンパイル使用メモリ | 22,528 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-05 19:11:24 |
合計ジャッジ時間 | 1,053 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 WA * 2 |
other | AC * 9 WA * 16 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:6:11: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 6 | scanf("%d%d",&N,&K); | ~~~~~^~~~~~~~~~~~~~ main.cpp:10:15: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 10 | scanf("%d",&A[i]); | ~~~~~^~~~~~~~~~~~ main.cpp:16:16: warning: ‘result’ may be used uninitialized in this function [-Wmaybe-uninitialized] 16 | if(result %2 ==1) | ~~~~~~~^~
ソースコード
#include <stdio.h> int main(void){ int i; int N,K; int result; //奇数:勝ち,偶数:負け scanf("%d%d",&N,&K); int A[1000]; for(i=0;i<N;i++){ scanf("%d",&A[i]); if(A[i]%(K+1) != 0 ){ result =result+1; } } if(result %2 ==1) printf("YES\n"); else printf("NO\n"); }