結果

問題 No.143 豆
ユーザー hippolover02hippolover02
提出日時 2022-07-20 17:29:49
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 572 bytes
コンパイル時間 1,955 ms
コンパイル使用メモリ 71,868 KB
実行使用メモリ 56,236 KB
最終ジャッジ日時 2023-09-15 09:53:45
合計ジャッジ時間 5,112 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 124 ms
55,948 KB
testcase_01 AC 131 ms
56,080 KB
testcase_02 AC 132 ms
55,788 KB
testcase_03 AC 130 ms
55,712 KB
testcase_04 AC 131 ms
55,836 KB
testcase_05 AC 129 ms
55,756 KB
testcase_06 AC 131 ms
55,540 KB
testcase_07 AC 132 ms
53,876 KB
testcase_08 AC 133 ms
55,764 KB
testcase_09 WA -
testcase_10 AC 128 ms
55,488 KB
testcase_11 AC 126 ms
55,540 KB
testcase_12 AC 127 ms
55,484 KB
testcase_13 AC 128 ms
55,712 KB
testcase_14 AC 133 ms
55,504 KB
testcase_15 AC 136 ms
55,516 KB
testcase_16 AC 125 ms
56,112 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