結果

問題 No.143 豆
ユーザー komori3
提出日時 2017-08-21 00:57:22
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 405 bytes
コンパイル時間 469 ms
コンパイル使用メモリ 62,696 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-07-23 10:49:06
合計ジャッジ時間 1,085 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 17
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <numeric>

using namespace std;
typedef long long int lint;

int main()
{
	int K, N, F, B, ans, tmp;
	vector<int> A;

	cin >> K >> N >> F;
	for (int i = 0; i < F; i++) {
		cin >> tmp;
		A.push_back(tmp);
	}

	B = K * N;
	ans = B - accumulate(A.begin(), A.end(), 0);

	cout << (ans < 0 ? -1 : ans) << endl;

	return 0;
}
0