結果

問題 No.143 豆
ユーザー newoota0331
提出日時 2016-09-02 09:12:36
言語 Java
(openjdk 23)
結果
AC  
実行時間 144 ms / 1,000 ms
コード長 600 bytes
コンパイル時間 2,120 ms
コンパイル使用メモリ 74,288 KB
実行使用メモリ 54,396 KB
最終ジャッジ日時 2024-07-23 10:34:53
合計ジャッジ時間 5,331 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 17
権限があれば一括ダウンロードができます

ソースコード

diff #

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

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

/* Name of the class has to be "Main" only if the class is public. */
class Ideone
{
	public static void main (String[] args) throws java.lang.Exception
	{
		Scanner sc = new Scanner(System.in);
		
		int mame,hukuro,human,old=0;
		mame = sc.nextInt();
		hukuro = sc.nextInt();
		mame *= hukuro;
		human = sc.nextInt();
		
		for(int i=0;i<human;i++){
			old += sc.nextInt();
		}
		
		mame -= old;
		if(mame>=0){
			System.out.println(mame);
		}else{
			System.out.println(-1);
		}
		
	}
}
0