結果

問題 No.143 豆
ユーザー spaciaspacia
提出日時 2015-12-19 08:26:11
言語 Java21
(openjdk 21)
結果
AC  
実行時間 44 ms / 1,000 ms
コード長 555 bytes
コンパイル時間 2,132 ms
コンパイル使用メモリ 71,680 KB
実行使用メモリ 49,528 KB
最終ジャッジ日時 2023-09-30 16:40:34
合計ジャッジ時間 3,491 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 42 ms
49,352 KB
testcase_01 AC 42 ms
49,396 KB
testcase_02 AC 42 ms
49,352 KB
testcase_03 AC 42 ms
49,352 KB
testcase_04 AC 42 ms
49,528 KB
testcase_05 AC 42 ms
47,676 KB
testcase_06 AC 42 ms
49,228 KB
testcase_07 AC 43 ms
49,468 KB
testcase_08 AC 42 ms
49,216 KB
testcase_09 AC 42 ms
49,172 KB
testcase_10 AC 43 ms
49,300 KB
testcase_11 AC 43 ms
49,316 KB
testcase_12 AC 43 ms
49,364 KB
testcase_13 AC 43 ms
49,228 KB
testcase_14 AC 44 ms
49,520 KB
testcase_15 AC 44 ms
49,376 KB
testcase_16 AC 43 ms
49,292 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.*;
import java.util.*;

class Main143 {
	
	public static void main (String[] args) throws IOException {
		BufferedReader br = 
			new BufferedReader(new InputStreamReader(System.in));
			
		String[] line1 = br.readLine().split(" ");
		int k = Integer.parseInt(line1[0]);
		int n = Integer.parseInt(line1[1]);
		int f = Integer.parseInt(line1[2]);
		int beans = k * n, sum = 0;
		String[] line2 = br.readLine().split(" ");
		for (String s : line2)
			sum += Integer.parseInt(s);
		
		System.out.println(sum <= beans ? beans - sum : -1);
	}
}
0