結果

問題 No.143 豆
ユーザー Syl514Syl514
提出日時 2020-06-14 23:23:04
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
RE  
実行時間 -
コード長 418 bytes
コンパイル時間 1,561 ms
コンパイル使用メモリ 166,536 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-10 10:57:53
合計ジャッジ時間 3,376 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h>
#define rep(i, n) for (int i = 1; i <= (n); i++)
using namespace std;
typedef long long ll;

int main(){
    int k, n, f;
    cin >> k >> n >> f;
    vector<int> a(n);
    rep(i ,f) cin >> a[i];
    int total = k * n;
    rep(i, f){
        total -= a[i];
        if(total < 0){
            cout << "-1" << endl;
            return 0;
        }
    }
    cout << total << endl;
    return 0;
}
0