結果

問題 No.143 豆
ユーザー ki_ki33
提出日時 2015-02-05 23:27:06
言語 Java
(openjdk 23)
結果
AC  
実行時間 143 ms / 1,000 ms
コード長 1,276 bytes
コンパイル時間 3,331 ms
コンパイル使用メモリ 83,472 KB
実行使用メモリ 54,504 KB
最終ジャッジ日時 2024-07-23 10:14:14
合計ジャッジ時間 5,494 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 17
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.BufferedInputStream;
import java.io.IOException;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.*;
import java.util.Map.Entry;
import java.util.concurrent.ConcurrentSkipListSet;

public class Main {
	public static final int C =  1000000007;
	static final int CY = 1000000000;
	//static boolean MAP[][];
	static int K;
	static int N;
	static int F;
	static String S;
	static int M;
	static int MAX = -1;
	//static int tic[][];
	static int T[][];
	static int Y[];
	static double W[];
	//static int max;
	static long DP[];
	static int ST[][];
	//static int p[];
	//static ArrayList<HashSet<Integer>> al;
	static ConcurrentSkipListSet<Integer> TS;
	static ArrayList<Integer> AL;
	//static int a[][];
	//static char[][] ch;
	//static ArrayList<HashMap<Long, Long>> al;
	//static String a[];
	//static String str;

	public static void main(String[] args) {
		StringBuilder sb = new StringBuilder();
		BufferedInputStream bs = new BufferedInputStream(System.in);
		Scanner sc = new Scanner(bs);



		K = sc.nextInt();
		N = sc.nextInt();
		F = sc.nextInt();

		int sum = 0;
		//int a[] = new int[F];
		for (int i=0; i <F; i++) {
			sum += sc.nextInt();
		}

		long ans = K*N - sum; 

		
		
		System.out.println(ans >= 0 ? ans: -1);

	}


}
0