結果

問題 No.143 豆
ユーザー gon_027gon_027
提出日時 2018-09-13 00:24:28
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 513 bytes
コンパイル時間 524 ms
コンパイル使用メモリ 51,808 KB
実行使用メモリ 4,388 KB
最終ジャッジ日時 2023-09-10 13:04:58
合計ジャッジ時間 1,511 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 1 ms
4,384 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 1 ms
4,380 KB
testcase_08 AC 1 ms
4,380 KB
testcase_09 WA -
testcase_10 AC 1 ms
4,376 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <string>
using namespace std;

#define p(x) cout << x << endl;
#define el cout << endl;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);

    int K, N, F;
    cin >> K >> N >> F;

    int A[F];
    for(int i = 0; i < F; ++i){
        cin >> A[i];
    }

    int beans = K * N;
    int sum = 0;

    for(int i = 0; i < F; ++i){
        sum += A[i];
    }

    int ans = 0;

    if (beans < sum){
        p(-1);
    }else{
        ans = beans - ans;
        p(ans);
    }
}
0