結果

問題 No.143 豆
ユーザー hippolover02hippolover02
提出日時 2022-07-20 17:29:18
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 570 bytes
コンパイル時間 4,549 ms
コンパイル使用メモリ 72,056 KB
実行使用メモリ 57,328 KB
最終ジャッジ日時 2023-09-15 09:53:41
合計ジャッジ時間 5,339 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 124 ms
55,788 KB
testcase_01 AC 131 ms
55,764 KB
testcase_02 AC 127 ms
55,916 KB
testcase_03 AC 127 ms
56,120 KB
testcase_04 AC 127 ms
55,740 KB
testcase_05 AC 128 ms
56,344 KB
testcase_06 AC 133 ms
56,392 KB
testcase_07 AC 133 ms
55,376 KB
testcase_08 AC 128 ms
55,900 KB
testcase_09 WA -
testcase_10 AC 130 ms
56,008 KB
testcase_11 AC 129 ms
55,940 KB
testcase_12 AC 133 ms
55,772 KB
testcase_13 AC 134 ms
55,732 KB
testcase_14 AC 135 ms
56,016 KB
testcase_15 AC 136 ms
57,328 KB
testcase_16 AC 125 ms
55,560 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;


public class Main {
    public static void main(String[] args) {
        // 自分の得意な言語で
        // Let's チャレンジ!!
        Scanner sc = new Scanner(System.in);
        int bean = sc.nextInt();
        int pack = sc.nextInt();
        int fam = sc.nextInt();
        int cnt = 0;
        
        for(int i=0;i<fam;i++){
            cnt += sc.nextInt();
        }
        if((bean * pack - cnt) > 0){
            System.out.println(bean * pack - cnt);
        } else{
            System.out.println(-1);
        }
    }
}
0