結果

問題 No.143 豆
ユーザー Pachicobue
提出日時 2017-10-25 00:08:21
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 217 bytes
コンパイル時間 540 ms
コンパイル使用メモリ 64,088 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-11-21 17:57:16
合計ジャッジ時間 1,200 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 1 WA * 16
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function 'int main()':
main.cpp:7:17: warning: 'f' is used uninitialized [-Wuninitialized]
    7 | for(int i= 0; i < f; i++){
      |               ~~^~~
main.cpp:5:11: note: 'f' was declared here
    5 | int k, n, f;
      |           ^
main.cpp:12:11: warning: 'k' is used uninitialized [-Wuninitialized]
   12 | if(sum > k*n){
      |          ~^~
main.cpp:5:5: note: 'k' was declared here
    5 | int k, n, f;
      |     ^
main.cpp:12:11: warning: 'n' is used uninitialized [-Wuninitialized]
   12 | if(sum > k*n){
      |          ~^~
main.cpp:5:8: note: 'n' was declared here
    5 | int k, n, f;
      |        ^

ソースコード

diff #

#include <iostream>
using namespace std;
int main()
{
int k, n, f;
int sum = 0;
for(int i= 0; i < f; i++){
int a;
cin >>a;
sum += a;
}
if(sum > k*n){
cout << -1 << endl;
} else {
cout << k*n-sum << endl;
}
return 0;
}
0