結果
問題 | No.143 豆 |
ユーザー |
![]() |
提出日時 | 2018-09-08 16:35:16 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 351 bytes |
コンパイル時間 | 1,546 ms |
コンパイル使用メモリ | 167,224 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-07-23 11:04:02 |
合計ジャッジ時間 | 2,168 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 6 WA * 11 |
コンパイルメッセージ
main.cpp: In function 'int main()': main.cpp:17:15: warning: 'sum' may be used uninitialized [-Wmaybe-uninitialized] 17 | if(k*n-sum>=0) cout << k*n-sum << endl; | ~~~^~~~ main.cpp:11:13: note: 'sum' was declared here 11 | int sum; | ^~~
ソースコード
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define pb push_back #define rep(i,n) for(int i=0;i<(n);++i) int main(){ cin.tie(0); ios::sync_with_stdio(false); int k,n,f;cin >> k >> n >> f; int sum; for(int i=0;i<f;++i){ int a; cin >> a; sum+=a; } if(k*n-sum>=0) cout << k*n-sum << endl; else cout << -1 << endl; }