結果

問題 No.143 豆
ユーザー ribenngeribennge
提出日時 2018-08-23 12:44:52
言語 Java21
(openjdk 21)
結果
AC  
実行時間 141 ms / 1,000 ms
コード長 430 bytes
コンパイル時間 2,567 ms
コンパイル使用メモリ 71,200 KB
実行使用メモリ 55,924 KB
最終ジャッジ日時 2023-09-30 17:21:06
合計ジャッジ時間 5,760 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 130 ms
55,672 KB
testcase_01 AC 137 ms
55,416 KB
testcase_02 AC 134 ms
55,412 KB
testcase_03 AC 136 ms
55,720 KB
testcase_04 AC 137 ms
55,920 KB
testcase_05 AC 139 ms
55,720 KB
testcase_06 AC 136 ms
55,924 KB
testcase_07 AC 138 ms
55,724 KB
testcase_08 AC 136 ms
55,464 KB
testcase_09 AC 137 ms
55,720 KB
testcase_10 AC 138 ms
55,748 KB
testcase_11 AC 133 ms
55,720 KB
testcase_12 AC 136 ms
55,648 KB
testcase_13 AC 141 ms
55,752 KB
testcase_14 AC 136 ms
55,656 KB
testcase_15 AC 136 ms
55,504 KB
testcase_16 AC 127 ms
55,840 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

class No_143{
	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[] a = new int[f];
		int sum = 0;
		
		for(int i = 0;i < f;i++){
		a[i] = sc.nextInt();
		sum += a[i];
		}
		
		if(sum > k * n){
		System.out.println(-1);
		}else{
		System.out.println(k * n - sum);
		}
		}
		}
0