結果

問題 No.143 豆
ユーザー FpmpAmpm
提出日時 2016-10-21 22:56:43
言語 Java
(openjdk 23)
結果
AC  
実行時間 140 ms / 1,000 ms
コード長 524 bytes
コンパイル時間 2,229 ms
コンパイル使用メモリ 74,448 KB
実行使用メモリ 54,408 KB
最終ジャッジ日時 2024-07-23 10:37:37
合計ジャッジ時間 5,000 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 17
権限があれば一括ダウンロードができます

ソースコード

diff #

/* package whatever; // don't place package name! */

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

class Ideone
{
	public static void main (String[] args) throws java.lang.Exception
	{
		// your code goes here
		Scanner sc = new Scanner(System.in);
    	int K = sc.nextInt();
    	int N = sc.nextInt();
    	// 人数
    	int F = sc.nextInt();
    	
    	int sum = 0;
    	
    	for (int i=0;i < F;i++) {
    		 sum += sc.nextInt();	
    	}
    	System.out.println((0 <= K * N - sum) ? K * N - sum : -1);
	}
}
0