結果

問題 No.143 豆
ユーザー xvfz57
提出日時 2019-10-26 23:17:31
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 389 bytes
コンパイル時間 539 ms
コンパイル使用メモリ 63,044 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-09-14 20:21:53
合計ジャッジ時間 1,378 ms
ジャッジサーバーID
(参考情報)
judge6 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 16 WA * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

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

using namespace std;

int main(){
  int k, n, f, age, sum;
  cin>>k>>n>>f;
  vector<int> age_v;
  for (int i=0;i<f;i++){
    cin >> age;
    age_v.push_back(age);
  }
  sum = accumulate(age_v.begin(), age_v.end(), 0);
  if (k * n > sum){
    cout << k * n - sum << endl;
  }else{
    cout << -1 << endl;
  }
}
0