結果

問題 No.143 豆
ユーザー okayu0518kut
提出日時 2023-07-12 16:09:45
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 310 bytes
コンパイル時間 1,594 ms
コンパイル使用メモリ 168,272 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-09-14 05:49:02
合計ジャッジ時間 2,415 ms
ジャッジサーバーID
(参考情報)
judge6 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 17
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

int main()
{
	int N, K, F;
	cin >> K >> N >> F;
	vector<int> A(F);
	int require = 0;
	for (int i = 0; i < F; i++)
	{
		cin >> A[i];
		require += A[i];
	}

	int ans = N * K - require;
	if (ans < 0)
	{
		cout << -1 << endl;
	}
	else
	{
		cout << ans << endl;
	}
}
0