結果
| 問題 | No.143 豆 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2018-03-15 22:54:54 |
| 言語 | C++11 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
WA
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 331 bytes |
| 記録 | |
| コンパイル時間 | 112 ms |
| コンパイル使用メモリ | 39,200 KB |
| 実行使用メモリ | 7,972 KB |
| 最終ジャッジ日時 | 2026-04-03 13:58:41 |
| 合計ジャッジ時間 | 726 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 2 WA * 15 |
コンパイルメッセージ
main.cpp: In function 'int main()':
main.cpp:10:15: warning: 'total' may be used uninitialized [-Wmaybe-uninitialized]
10 | total += A;
| ~~~~~~^~~~
main.cpp:6:9: note: 'total' was declared here
6 | int total;
| ^~~~~
ソースコード
#include <stdio.h>
int main(){
//input
int K,N,F;
scanf("%d %d %d",&K,&N,&F);
int total;
for (int i = 0;i < F;i++){
int A;
scanf("%d",&A);
total += A;
}
//output
if (total <= K*N){
printf("%d\n",K*N-total);
}else{
printf("%d\n",-1);
}
return 0;
}