結果
問題 |
No.143 豆
|
ユーザー |
![]() |
提出日時 | 2022-12-02 04:29:53 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 1,000 ms |
コード長 | 305 bytes |
コンパイル時間 | 671 ms |
コンパイル使用メモリ | 71,720 KB |
最終ジャッジ日時 | 2025-02-09 03:08:53 |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 17 |
ソースコード
#include <iostream> #include <vector> #include <numeric> using namespace std; int main() { int k, n, f; cin >> k >> n >> f; vector<int> a(f); for (int i = 0; i < f; i++) cin >> a[i]; int ans = (k * n) - accumulate(a.begin(), a.end(), 0); cout << (ans >= 0 ? ans : -1) << endl; }