結果

問題 No.143 豆
ユーザー dogwood0424dogwood0424
提出日時 2017-11-29 19:53:49
言語 Java21
(openjdk 21)
結果
AC  
実行時間 139 ms / 1,000 ms
コード長 425 bytes
コンパイル時間 3,377 ms
コンパイル使用メモリ 72,636 KB
実行使用メモリ 55,936 KB
最終ジャッジ日時 2023-09-30 17:09:56
合計ジャッジ時間 6,629 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 127 ms
55,848 KB
testcase_01 AC 135 ms
55,460 KB
testcase_02 AC 133 ms
55,828 KB
testcase_03 AC 135 ms
55,444 KB
testcase_04 AC 139 ms
55,756 KB
testcase_05 AC 134 ms
55,764 KB
testcase_06 AC 135 ms
53,748 KB
testcase_07 AC 136 ms
55,904 KB
testcase_08 AC 136 ms
55,672 KB
testcase_09 AC 137 ms
55,676 KB
testcase_10 AC 137 ms
55,436 KB
testcase_11 AC 135 ms
55,936 KB
testcase_12 AC 134 ms
55,848 KB
testcase_13 AC 137 ms
55,744 KB
testcase_14 AC 137 ms
55,772 KB
testcase_15 AC 137 ms
55,672 KB
testcase_16 AC 128 ms
55,888 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class No143 {
	public static void main(String[]args) {
		Scanner sc = new Scanner(System.in);

		int K,N,F;
		K = sc.nextInt();
		N = sc.nextInt();
		F = sc.nextInt();

		int []a = new int[F];
		int B=0 ;

		for(int i=0;i<F;i++) {
			a[i] = sc.nextInt();
			B +=a[i];
		}

		int S ;
		S = K * N;

		if(S-B>=0) {
			System.out.println(S-B);
		}
		else {
			System.out.println(-1);
		}


	}

}
0