結果

問題 No.143 豆
ユーザー cleasky
提出日時 2023-06-04 01:47:51
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 387 bytes
コンパイル時間 1,834 ms
コンパイル使用メモリ 191,752 KB
最終ジャッジ日時 2025-02-13 22:31:40
ジャッジサーバーID
(参考情報)
judge5 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 17
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int main()
{
    cin.tie(0)->sync_with_stdio(0);

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

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

    int beans = K * N;
    if (beans < A) {
        cout << -1 << endl;
    } else {
        cout << beans - A << endl;
    }

    return 0;
}
0