結果
問題 | No.143 豆 |
ユーザー |
![]() |
提出日時 | 2016-06-05 04:01:40 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 1,000 ms |
コード長 | 346 bytes |
コンパイル時間 | 679 ms |
コンパイル使用メモリ | 64,132 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-07-23 10:31:05 |
合計ジャッジ時間 | 1,158 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 17 |
ソースコード
#include <iostream> #include <stdio.h> #include <math.h> #include <vector> #include <algorithm> using namespace std; int main(){ int k,n,f; cin >> k >> n >> f; int a[f]; for(int i=0;i<f;i++) cin >> a[i]; int sum = 0; for(int i=0;i<f;i++){ sum += a[i]; } if( sum > k*n ) cout << -1 << endl; else cout << k*n - sum << endl; return 0; }