結果
問題 | No.143 豆 |
ユーザー |
![]() |
提出日時 | 2020-02-02 17:56:58 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 1,000 ms |
コード長 | 373 bytes |
コンパイル時間 | 1,530 ms |
コンパイル使用メモリ | 167,656 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-07-23 11:25:01 |
合計ジャッジ時間 | 2,356 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 17 |
ソースコード
#include <bits/stdc++.h>using namespace std;int main(){int k,n,f;cin >> k >> n >> f;int humans[f];int totalBeans = k*n;int needBeans = 0;for(int i = 0; i < f; i++){cin >> humans[i];needBeans += humans[i];}int ans = totalBeans - needBeans;if(ans < 0){cout << -1 << endl;}else{cout << ans << endl;}return 0;}