結果

問題 No.143 豆
ユーザー marumaru
提出日時 2016-03-20 01:50:08
言語 Java21
(openjdk 21)
結果
AC  
実行時間 122 ms / 1,000 ms
コード長 597 bytes
コンパイル時間 3,179 ms
コンパイル使用メモリ 73,328 KB
実行使用メモリ 56,092 KB
最終ジャッジ日時 2023-09-30 16:43:30
合計ジャッジ時間 6,145 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 119 ms
55,952 KB
testcase_01 AC 119 ms
55,640 KB
testcase_02 AC 120 ms
55,652 KB
testcase_03 AC 122 ms
55,932 KB
testcase_04 AC 120 ms
55,428 KB
testcase_05 AC 120 ms
55,740 KB
testcase_06 AC 119 ms
56,092 KB
testcase_07 AC 121 ms
55,724 KB
testcase_08 AC 118 ms
55,736 KB
testcase_09 AC 119 ms
55,576 KB
testcase_10 AC 118 ms
55,484 KB
testcase_11 AC 119 ms
55,820 KB
testcase_12 AC 118 ms
55,652 KB
testcase_13 AC 118 ms
55,912 KB
testcase_14 AC 122 ms
55,700 KB
testcase_15 AC 120 ms
56,020 KB
testcase_16 AC 118 ms
55,904 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class yukicoder_143 {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		
		String n = scanner.nextLine();
		String m = scanner.nextLine();
		
		
		String[] array = n.split(" ");
		int sum = Integer.parseInt(array[0]) * Integer.parseInt(array[1]);
		
		String[] array_fam = m.split(" ");
		
		int sum_fam = 0;
		
		for (int i = 0; i < array_fam.length; i++) {
			sum_fam += Integer.parseInt(array_fam[i]);
		}
		
		
		if (sum >= sum_fam) {
			System.out.println(sum - sum_fam);
		} else {
			System.out.println(-1);
		}
	}
}
	
0