結果
| 問題 |
No.143 豆
|
| コンテスト | |
| ユーザー |
kt88
|
| 提出日時 | 2019-09-03 21:00:52 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 1,000 ms |
| コード長 | 1,430 bytes |
| コンパイル時間 | 903 ms |
| コンパイル使用メモリ | 96,148 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-07-23 11:18:45 |
| 合計ジャッジ時間 | 1,516 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 17 |
ソースコード
/*
これを入れて実行
g++ code.cpp
./a.out
*/
#include <iostream>
#include <vector>
#include <string>
#include <queue>
#include <deque>
#include <algorithm>
#include <utility>
#include <set>
#include <map>
#include <cmath>
#include <math.h>
#include <tuple>
#include <iomanip>
using namespace std;
typedef long long ll;
typedef long double ld;
int dy4[4] = {-1, 0, +1, 0};
int dx4[4] = {0, +1, 0, -1};
int dy8[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
int dx8[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const long long INF = 1LL << 60;
const ll MOD = 1e9 + 7;
bool greaterSecond(const pair<int, int>& f, const pair<int, int>& s){
return f.second > s.second;
}
ll gcd(ll a, ll b){
if (b == 0)return a;
return gcd(b, a % b);
}
ll lcm(ll a, ll b){
return a / gcd(a, b) * b;
}
ll nCr(ll n, ll r){
if(r == 0 || r == n){
return 1;
} else if(r == 1){
return n;
}
return (nCr(n - 1, r) + nCr(n - 1, r - 1));
}
ll nPr(ll n, ll r){
r = n - r;
ll ret = 1;
for (ll i = n; i >= r + 1; i--) ret *= i;
return ret;
}
//-----------------------ここから-----------
int main(void){
int k, n, f;
cin >> k >> n >> f;
int ans = k * n;
vector<int> a(f);
for(int i = 0; i < f; i++) cin >> a[i];
for(int i = 0; i < f; i++){
ans -= a[i];
if(ans < 0){
cout << -1 << endl;
return 0;
}
}
cout << ans << endl;
}
kt88