結果

問題 No.143 豆
ユーザー wightou
提出日時 2025-04-29 00:53:45
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 649 bytes
コンパイル時間 4,190 ms
コンパイル使用メモリ 274,488 KB
実行使用メモリ 6,272 KB
最終ジャッジ日時 2025-04-29 00:53:50
合計ジャッジ時間 4,145 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 17
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

/////////////////// メイン ///////////////////

int main () {
  
  //////////////////// 入力 ////////////////////

  int k, n, f;
  cin >> k >> n >> f;

  vector<int> a(f);
  for (int i=0; i<f; i++) {
    cin >> a.at(i);
  }

  //////////////// 出力変数定義 ////////////////

  int result = 0;

  //////////////////// 処理 ////////////////////

  result = accumulate(a.begin(),a.end(),0);
  result = k*n - result;
  if (result<0) result = -1;

  //////////////////// 出力 ////////////////////

  cout << result << endl;

  //////////////////// 終了 ////////////////////

  return 0;

}
0