結果
| 問題 | No.143 豆 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2018-03-15 22:54:54 |
| 言語 | C++11 (gcc 15.3.0 + boost 1.92.0) |
| 結果 |
WA
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 331 bytes |
| 記録 | |
| コンパイル時間 | 89 ms |
| コンパイル使用メモリ | 37,632 KB |
| 実行使用メモリ | 6,272 KB |
| 最終ジャッジ日時 | 2026-08-24 00:08:39 |
| 合計ジャッジ時間 | 1,326 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 4 WA * 13 |
コンパイルメッセージ
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;
}