結果
問題 | No.143 豆 |
ユーザー |
|
提出日時 | 2018-03-27 19:34:53 |
言語 | C++11 (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 1,000 ms |
コード長 | 278 bytes |
コンパイル時間 | 425 ms |
コンパイル使用メモリ | 55,172 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-07-23 10:56:38 |
合計ジャッジ時間 | 1,030 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 17 |
ソースコード
#include<iostream>using namespace std;int main(){int K,N,F,sum;cin >> K >> N >> F;sum = K*N;int age,needs=0;for(int i=0; i<F; i++){cin >> age;needs += age;}if(sum < needs){cout << -1 << endl;}else{cout << sum-needs << endl;}}