結果

問題 No.143 豆
ユーザー kohaku_kohakukohaku_kohaku
提出日時 2016-11-09 20:17:04
言語 Java21
(openjdk 21)
結果
AC  
実行時間 141 ms / 1,000 ms
コード長 423 bytes
コンパイル時間 2,118 ms
コンパイル使用メモリ 72,140 KB
実行使用メモリ 57,740 KB
最終ジャッジ日時 2023-09-30 16:54:16
合計ジャッジ時間 5,266 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 126 ms
55,840 KB
testcase_01 AC 134 ms
55,756 KB
testcase_02 AC 132 ms
55,668 KB
testcase_03 AC 134 ms
56,124 KB
testcase_04 AC 134 ms
56,060 KB
testcase_05 AC 135 ms
53,772 KB
testcase_06 AC 135 ms
55,772 KB
testcase_07 AC 135 ms
56,072 KB
testcase_08 AC 135 ms
55,588 KB
testcase_09 AC 138 ms
56,076 KB
testcase_10 AC 137 ms
55,764 KB
testcase_11 AC 133 ms
55,664 KB
testcase_12 AC 135 ms
53,812 KB
testcase_13 AC 141 ms
55,596 KB
testcase_14 AC 136 ms
57,740 KB
testcase_15 AC 138 ms
55,788 KB
testcase_16 AC 127 ms
53,764 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int K = sc.nextInt();
        int N = sc.nextInt();
int sum = K*N;
        int F = sc.nextInt();
        int [] A = new int [F];
int total =0;
for(int i=0; i<F; i++){
A[i]=sc.nextInt();
total = total + A[i];
}
int r = sum-total;
if(r<0){
r=-1;
}
        System.out.println(r);
    }
}
0