結果

問題 No.143 豆
ユーザー jimano
提出日時 2015-10-13 22:59:16
言語 Java
(openjdk 23)
結果
WA  
実行時間 -
コード長 396 bytes
コンパイル時間 3,816 ms
コンパイル使用メモリ 77,080 KB
実行使用メモリ 54,332 KB
最終ジャッジ日時 2024-07-21 07:37:51
合計ジャッジ時間 6,689 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 16 WA * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class No143 {
	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 i = 0, j = 0;

		while(sc.hasNext()){
			age[i] = sc.nextInt();
			i++;
		}

		for(int a : age) j += a;

		System.out.println( (k * n > j) ? k * n - j : -1 );
	}
}
0