結果

問題 No.143 豆
ユーザー もぐらもぐら
提出日時 2024-04-27 20:33:29
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 1,325 bytes
コンパイル時間 1,292 ms
コンパイル使用メモリ 169,700 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-27 20:33:31
合計ジャッジ時間 1,854 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,816 KB
testcase_01 AC 2 ms
6,944 KB
testcase_02 AC 1 ms
6,940 KB
testcase_03 AC 1 ms
6,940 KB
testcase_04 AC 2 ms
6,944 KB
testcase_05 AC 1 ms
6,944 KB
testcase_06 AC 1 ms
6,944 KB
testcase_07 AC 1 ms
6,940 KB
testcase_08 AC 1 ms
6,940 KB
testcase_09 AC 1 ms
6,940 KB
testcase_10 AC 1 ms
6,940 KB
testcase_11 AC 2 ms
6,940 KB
testcase_12 AC 1 ms
6,940 KB
testcase_13 AC 1 ms
6,944 KB
testcase_14 AC 2 ms
6,944 KB
testcase_15 AC 1 ms
6,940 KB
testcase_16 AC 1 ms
6,944 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include <atcoder/modint>
using namespace std;
#define rep(i,n) for(int i = 0; i <n; i++)
#define all(a) a.begin(),a.end()
#define SORT(a) sort(all(a));
#define MIN(a) *min_element(all(a))
#define MAX(a) *max_element(all(a))
#define SUM(a) accumulate(all(a),0LL)
using ll=long long;
using ld=long double;
using ull=unsigned long;
ll MOD=998244353;

const ld PI=3.1415926535897932;
const int dx[]={0,1,0,-1,1,-1,1,-1};const int dy[]={1,0,-1,0,1,1,-1,-1};
const string ALPHA="ABCDEFGHIJKLMNOPQRSTUVWXYZ";const string alpha="abcdefghijklmnopqrstuvwxyz";
bool prime(ll n){
  for(ll i=2;i*i<n;i++){
    if(n%i==0){return false;}
  }
  return true;
}
using Graph = vector<vector<int>>;
ll fac[510000],finv[510000],inv[510000];
// 二項係数前
void comb_init(){
  fac[0]=fac[1]=1;
  finv[0]=finv[1]=1;
  inv[1]=1;
  for(ll i=2;i<510000;i++){
    fac[i]=fac[i-1]*i%MOD;
    inv[i]=MOD-inv[MOD%i]*(MOD/i)%MOD;
    finv[i]=finv[i-1]*inv[i]%MOD;
  }
}
ll comb(ll n,ll r){
  if(n<r)return 0;
  if(n<0||r<0)return 0;
  return fac[n] * (finv[r] * finv[n-r]%MOD)%MOD;
}
//二項係数終

int main(){
  cin.tie(nullptr);
  cout.tie(nullptr);
  ios::sync_with_stdio(false);
  ll K,N,F;cin>>K>>N>>F;
  ll ans=K*N;
  rep(i,F){
    ll A;cin>>A;
    ans-=A;
  }
  if(ans<0){cout<<-1<<endl;}
  else{cout<<ans<<endl;}
}
0