結果

問題 No.143 豆
ユーザー Vertigo
提出日時 2024-04-02 19:26:04
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 326 bytes
コンパイル時間 693 ms
コンパイル使用メモリ 69,532 KB
最終ジャッジ日時 2025-02-20 19:42:01
ジャッジサーバーID
(参考情報)
judge1 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 17
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int main(){
    int n, m, a, res = 0;
    cin >> n >> m >> a;
    
    for(int i = 0; i < a; i++){
        int l;
        cin >> l;
        res += l;
    }
    if (n*m - res < 0){
        cout << -1 << endl;
    }
    else cout << n*m - res << endl;
    return 0;
}
0