結果

問題 No.143 豆
ユーザー SyuutaroSyuutaro
提出日時 2018-03-15 22:54:54
言語 C++11
(gcc 11.4.0)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 331 bytes
コンパイル時間 721 ms
コンパイル使用メモリ 24,548 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-30 17:14:08
合計ジャッジ時間 899 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 1 ms
4,380 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 1 ms
4,376 KB
testcase_07 AC 1 ms
4,380 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 WA -
testcase_10 AC 1 ms
4,380 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:15:15: warning: ‘total’ may be used uninitialized in this function [-Wmaybe-uninitialized]
         printf("%d\n",K*N-total);
         ~~~~~~^~~~~~~~~~~~~~~~~~

ソースコード

diff #

#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;
}
0