結果

問題 No.143 豆
ユーザー hryshtk
提出日時 2015-06-29 23:24:30
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 421 bytes
コンパイル時間 1,411 ms
コンパイル使用メモリ 157,752 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-07-23 10:20:16
合計ジャッジ時間 2,136 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 17
権限があれば一括ダウンロードができます

ソースコード

diff #

using namespace std;
#include <bits/stdc++.h>
#define BEGIN ios_base::sync_with_stdio(0);cin.tie(0);
#define END return EXIT_SUCCESS;
#define FOR(I,A,B) for(int (I)=(A);(I)<(B);++(I))
#define ALL(C) (C).begin(),(C).end()
inline void solve()
{
	int K,N,F,S;cin>>K>>N>>F;S=K*N;
	int T,A=0;FOR(i,0,F){cin>>T;A+=T;}
	if(S>=A)cout<<(S-A)<<endl;
	else cout<<(-1)<<endl;
}
int main(int argc,char**argv)
{
	BEGIN
	solve();
	END
}
0