結果

問題 No.143 豆
ユーザー H.Yamada
提出日時 2016-02-18 08:28:34
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 371 bytes
コンパイル時間 605 ms
コンパイル使用メモリ 64,320 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-07-23 10:26:42
合計ジャッジ時間 1,109 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 17
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int main(){
  int K,N,F;
  std::vector<int> A;

  std::cin >> K >> N >> F;
  A.reserve(F);

  std::copy_n(std::istream_iterator<int>(std::cin),F,std::back_inserter(A));

  std::cout << std::max(-1,K*N - std::accumulate(A.begin(),A.end(),0)) << std::endl;
  
  return 0;
}
0