結果
問題 |
No.143 豆
|
ユーザー |
|
提出日時 | 2018-03-15 22:54:54 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 331 bytes |
コンパイル時間 | 112 ms |
コンパイル使用メモリ | 22,656 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-07-23 10:56:15 |
合計ジャッジ時間 | 739 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 6 WA * 11 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:5:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 5 | scanf("%d %d %d",&K,&N,&F); | ~~~~~^~~~~~~~~~~~~~~~~~~~~ main.cpp:9:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 9 | scanf("%d",&A); | ~~~~~^~~~~~~~~ main.cpp:15:15: warning: ‘total’ may be used uninitialized in this function [-Wmaybe-uninitialized] 15 | printf("%d\n",K*N-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; }