結果

問題 No.143 豆
ユーザー 水野嶺水野嶺
提出日時 2020-05-20 16:10:55
言語 Java21
(openjdk 21)
結果
AC  
実行時間 133 ms / 1,000 ms
コード長 492 bytes
コンパイル時間 3,116 ms
コンパイル使用メモリ 70,812 KB
実行使用メモリ 56,324 KB
最終ジャッジ日時 2023-09-30 17:50:46
合計ジャッジ時間 5,048 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 122 ms
55,832 KB
testcase_01 AC 131 ms
55,820 KB
testcase_02 AC 129 ms
55,992 KB
testcase_03 AC 130 ms
55,752 KB
testcase_04 AC 130 ms
55,568 KB
testcase_05 AC 131 ms
55,872 KB
testcase_06 AC 131 ms
53,368 KB
testcase_07 AC 132 ms
56,052 KB
testcase_08 AC 132 ms
55,656 KB
testcase_09 AC 132 ms
55,868 KB
testcase_10 AC 130 ms
55,864 KB
testcase_11 AC 126 ms
56,028 KB
testcase_12 AC 130 ms
55,796 KB
testcase_13 AC 130 ms
55,696 KB
testcase_14 AC 131 ms
56,012 KB
testcase_15 AC 133 ms
56,324 KB
testcase_16 AC 122 ms
55,788 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

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