結果

問題 No.143 豆
ユーザー NewbiekunNewbiekun
提出日時 2019-02-20 17:37:12
言語 Java21
(openjdk 21)
結果
AC  
実行時間 143 ms / 1,000 ms
コード長 390 bytes
コンパイル時間 5,329 ms
コンパイル使用メモリ 73,940 KB
実行使用メモリ 55,860 KB
最終ジャッジ日時 2023-09-30 17:27:07
合計ジャッジ時間 8,860 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 133 ms
55,460 KB
testcase_01 AC 141 ms
55,720 KB
testcase_02 AC 139 ms
55,720 KB
testcase_03 AC 139 ms
55,844 KB
testcase_04 AC 142 ms
55,724 KB
testcase_05 AC 143 ms
55,696 KB
testcase_06 AC 140 ms
55,488 KB
testcase_07 AC 143 ms
55,816 KB
testcase_08 AC 140 ms
55,472 KB
testcase_09 AC 141 ms
55,728 KB
testcase_10 AC 142 ms
55,816 KB
testcase_11 AC 136 ms
55,656 KB
testcase_12 AC 137 ms
55,768 KB
testcase_13 AC 141 ms
55,452 KB
testcase_14 AC 139 ms
55,636 KB
testcase_15 AC 141 ms
55,844 KB
testcase_16 AC 133 ms
55,860 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class No143
{
	public static void main(String args[])
	{
		Scanner sc = new Scanner(System.in);
		int mame = sc.nextInt() * sc.nextInt();
		int f = sc.nextInt(); // 人数
		for( int i = 0; i < f; i++ ){ mame -= sc.nextInt(); }

// 0以上なら残りのmameの数を表示、それ以外は-1を表示
		System.out.println( (mame >= 0) ? mame : -1 );
	}
}
0