結果

問題 No.143 豆
ユーザー KKT89
提出日時 2019-12-23 03:53:16
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 379 bytes
コンパイル時間 669 ms
コンパイル使用メモリ 77,816 KB
最終ジャッジ日時 2025-01-08 14:07:35
ジャッジサーバーID
(参考情報)
judge1 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 17
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
using namespace std;
typedef long long int ll;

int main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	int k,n,f; cin >> k >> n >> f;
	vector<int> a(f);
	int sum=0;
	for(int i=0;i<f;i++){
		cin >> a[i];
		sum+=a[i];
	}
	if(k*n>=sum){
		cout << k*n-sum << endl;
	}
	else{
		cout << -1 << endl;
	}
}
0