結果

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

ソースコード

diff #

#include <iostream>
#include <sstream>
#include <vector>
#include <algorithm>
#include <string>
#include <functional>
#include <numeric>
#include <ctype.h>
#include <cstdlib>
#include <string.h>
#include <cmath>
#include <cstdio>
#include <map>
#include <queue>
#include <utility>

using namespace std;

const int INF = 1000000007;
const double PI = acos(-1.0);


int main()
{
	int k, n, f;
	int beans = 0;
	vector<int> peo;
	cin >> k >> n >> f;
	
	beans = k * n;
	for (int i = 0; i < f; i++)
	{
		int input;
		cin >> input;
		peo.push_back(input);
	}

	int ans = beans - accumulate(peo.begin(), peo.end(), 0);

	cout << max(ans, -1) << endl;
	
}
0