結果

問題 No.143 豆
ユーザー kpinkcatkpinkcat
提出日時 2023-08-03 15:31:46
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 421 bytes
コンパイル時間 849 ms
コンパイル使用メモリ 106,096 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-21 13:40:43
合計ジャッジ時間 1,527 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 2 ms
5,376 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 1 ms
5,376 KB
testcase_08 AC 1 ms
5,376 KB
testcase_09 WA -
testcase_10 AC 2 ms
5,376 KB
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:19:14: warning: 'sum1' may be used uninitialized [-Wmaybe-uninitialized]
   19 |         sum1 += t;
      |         ~~~~~^~~~
main.cpp:14:18: note: 'sum1' was declared here
   14 |     int k, n, f, sum1;
      |                  ^~~~

ソースコード

diff #

#include<iostream>
#include<string>
#include<algorithm>
#include<cctype>
#include<set>
#include<bitset>
#include<math.h>
#include<map>
#include<queue>
#include<iomanip>
using namespace std;

int main(){
    int k, n, f, sum1;
    cin >> k >> n >> f;
    for (int i = 0; i < f; i++){
        int t;
        cin >> t;
        sum1 += t;
    }
    if (k*n >= sum1) cout << k*n - sum1 << endl;
    else cout << -1 << endl;
}
0