結果
| 問題 |
No.143 豆
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-08-15 05:53:48 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 1,000 ms |
| コード長 | 818 bytes |
| コンパイル時間 | 891 ms |
| コンパイル使用メモリ | 79,892 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-07-23 11:35:17 |
| 合計ジャッジ時間 | 1,379 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 17 |
ソースコード
#include <iostream> //cin, cout
#include <vector> //vector
#include <algorithm> //sort,min,max
#include <string> //string
#include <ios> //fixed
#include <iomanip> //setprecision
#include <utility> //swap
#include <cstdlib> //abs(int)
#include <cmath> //sqrt
#include <sstream> //stringstream,getline
using namespace std;
inline std::vector<std::string> Split_String(const std::string& str, const char key) {
std::vector<std::string> result;
std::stringstream SS(str);
std::string temp;
while (std::getline(SS, temp, key)) {
result.push_back(temp);
}
return(result);
}
int main() {
int K, N, F;
cin >> K >> N >> F;
int A = 0, temp = 0;
for (int i = 0; i < F; i++) {
cin >> temp;
A += temp;
}
if (K * N >= A) {
cout << K * N - A << endl;
}
else {
cout << -1 << endl;
}
return 0;
}