結果

問題 No.143 豆
ユーザー Taku Kitamura
提出日時 2022-11-21 23:15:35
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 383 bytes
コンパイル時間 681 ms
コンパイル使用メモリ 68,060 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-09-22 12:46:58
合計ジャッジ時間 1,396 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 17
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main() {
    int K, N, F;
    cin >> K >> N >> F;

    int beans_count = K * N;

    int A;

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

    if (beans_count < 0) {
        cout << -1 << endl;
    } else {
        cout << beans_count;
    }

    return 0;
}
0