結果

問題 No.143 豆
ユーザー AOW_MIRROR_O5AOW_MIRROR_O5
提出日時 2018-03-08 16:41:36
言語 Java21
(openjdk 21)
結果
AC  
実行時間 135 ms / 1,000 ms
コード長 452 bytes
コンパイル時間 4,038 ms
コンパイル使用メモリ 72,508 KB
実行使用メモリ 56,184 KB
最終ジャッジ日時 2023-09-30 17:13:45
合計ジャッジ時間 7,349 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 124 ms
55,896 KB
testcase_01 AC 131 ms
55,944 KB
testcase_02 AC 128 ms
55,652 KB
testcase_03 AC 131 ms
55,916 KB
testcase_04 AC 129 ms
55,868 KB
testcase_05 AC 128 ms
55,624 KB
testcase_06 AC 130 ms
55,996 KB
testcase_07 AC 130 ms
55,424 KB
testcase_08 AC 130 ms
55,988 KB
testcase_09 AC 133 ms
55,852 KB
testcase_10 AC 135 ms
55,596 KB
testcase_11 AC 126 ms
56,092 KB
testcase_12 AC 128 ms
56,184 KB
testcase_13 AC 129 ms
55,992 KB
testcase_14 AC 132 ms
55,788 KB
testcase_15 AC 132 ms
55,732 KB
testcase_16 AC 121 ms
55,684 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class paiza7 {
    public static void main(String[] args) {
		
        Scanner sc = new Scanner(System.in);
        int K = sc.nextInt();
		int N = sc.nextInt();
		int F = sc.nextInt();
		int age[] = new int[F];
		int TotalAge = 0;
		
		for(int i=0;i<F;i++){
			age[i] = sc.nextInt();
			TotalAge += age[i];
		}
		
		if((K*N)>=TotalAge){
			System.out.println(K*N-TotalAge);
		}else{
			System.out.println("-1");
		}
    }
}
0