結果

問題 No.143 豆
ユーザー PachicobuePachicobue
提出日時 2017-10-25 00:08:21
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 217 bytes
コンパイル時間 484 ms
コンパイル使用メモリ 64,360 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-05-01 13:17:42
合計ジャッジ時間 1,119 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 2 ms
6,940 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
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