結果

問題 No.143 豆
ユーザー newoota0331newoota0331
提出日時 2016-09-02 09:12:36
言語 Java21
(openjdk 21)
結果
AC  
実行時間 141 ms / 1,000 ms
コード長 600 bytes
コンパイル時間 2,009 ms
コンパイル使用メモリ 71,684 KB
実行使用メモリ 56,276 KB
最終ジャッジ日時 2023-09-30 16:49:35
合計ジャッジ時間 5,342 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 127 ms
55,636 KB
testcase_01 AC 135 ms
55,788 KB
testcase_02 AC 134 ms
55,904 KB
testcase_03 AC 136 ms
55,628 KB
testcase_04 AC 136 ms
55,856 KB
testcase_05 AC 134 ms
55,816 KB
testcase_06 AC 137 ms
55,588 KB
testcase_07 AC 137 ms
53,776 KB
testcase_08 AC 136 ms
53,524 KB
testcase_09 AC 137 ms
55,456 KB
testcase_10 AC 136 ms
55,824 KB
testcase_11 AC 132 ms
55,728 KB
testcase_12 AC 135 ms
56,276 KB
testcase_13 AC 137 ms
55,752 KB
testcase_14 AC 138 ms
55,900 KB
testcase_15 AC 141 ms
55,828 KB
testcase_16 AC 129 ms
55,768 KB
権限があれば一括ダウンロードができます

ソースコード

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