結果
問題 |
No.143 豆
|
ユーザー |
![]() |
提出日時 | 2019-06-27 21:49:28 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 279 bytes |
コンパイル時間 | 1,080 ms |
コンパイル使用メモリ | 65,632 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-07-23 11:15:34 |
合計ジャッジ時間 | 1,327 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 6 WA * 11 |
コンパイルメッセージ
main.cpp: In function 'int main()': main.cpp:20:29: warning: 'sum' may be used uninitialized [-Wmaybe-uninitialized] 20 | cout << N*K-sum; | ^~~ main.cpp:9:13: note: 'sum' was declared here 9 | int sum; | ^~~
ソースコード
#include<iostream> #include<algorithm> using namespace std; using lint=int64_t; int main() { int K,N,F; int sum; cin >> K >> N >> F; for(int i=0;i<F;i++) { int A; cin >> A; sum+=A; } if(sum<=N*K) cout << N*K-sum; else cout << -1; cout << endl; return 0; }