結果

問題 No.143 豆
ユーザー test_test
提出日時 2019-02-19 12:07:47
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 341 bytes
コンパイル時間 449 ms
コンパイル使用メモリ 62,592 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-10-11 20:35:00
合計ジャッジ時間 1,085 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 4 WA * 13
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
using namespace std;

int main() {
    int k, n, f;
    cin >> k >> n >> f;
    
    int sum = k * n;
    
    int needed = 0;
    for (int i = 0; i < f; i++) {
        int a;
        cin >> a;
        needed += a;
    }
    
    if (sum <= needed) {
        cout << sum - needed;
    } else {
        cout << -1;
    }
}
0