結果

問題 No.143 豆
ユーザー matsuyoshi30
提出日時 2016-02-04 12:59:55
言語 Java
(openjdk 23)
結果
AC  
実行時間 137 ms / 1,000 ms
コード長 417 bytes
コンパイル時間 2,084 ms
コンパイル使用メモリ 75,072 KB
実行使用メモリ 54,320 KB
最終ジャッジ日時 2024-07-23 10:26:20
合計ジャッジ時間 4,936 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 17
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

class Test {
	public static void main(String[] args) throws Exception {
		Scanner in = new Scanner(System.in);
		int k = in.nextInt();
		int n = in.nextInt();
		int f = in.nextInt();

		int[] a = new int[f];
		int sum = k * n;
		for(int i=0; i<f; i++) {
			a[i] = in.nextInt();
			sum -= a[i];
		}

		if(sum < 0) {
			System.out.println(-1);
		} else {
			System.out.println(sum);
		}
	}
}
0