結果

問題 No.143 豆
ユーザー sakaisakai
提出日時 2020-11-11 13:31:48
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 268 bytes
コンパイル時間 1,381 ms
コンパイル使用メモリ 162,624 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-30 00:29:06
合計ジャッジ時間 2,368 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 2 ms
4,380 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 1 ms
4,376 KB
testcase_06 AC 1 ms
4,376 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 WA -
testcase_10 AC 2 ms
4,376 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: 関数 ‘int main()’ 内:
main.cpp:10:13: 警告: ‘total’ may be used uninitialized [-Wmaybe-uninitialized]
   10 |     if((K*N)-total>0){
      |        ~~~~~^~~~~~
main.cpp:4:17: 備考: ‘total’ はここで定義されています
    4 |     int K,N,F,A,total,answer;
      |                 ^~~~~

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
int main(){
    int K,N,F,A,total,answer;
    cin >>K>>N>>F;
    for(int i = 0;i<F;i++){
        cin>>A;
        total += A;
    }
    if((K*N)-total>0){
        cout<<(K*N)-total;
    }
    else{
        cout<<-1;
    }
}
0