結果

問題 No.143 豆
ユーザー Newbiekun
提出日時 2019-02-20 17:37:12
言語 Java
(openjdk 23)
結果
AC  
実行時間 142 ms / 1,000 ms
コード長 390 bytes
コンパイル時間 4,021 ms
コンパイル使用メモリ 74,304 KB
実行使用メモリ 54,460 KB
最終ジャッジ日時 2024-07-23 11:09:20
合計ジャッジ時間 6,940 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 17
権限があれば一括ダウンロードができます

ソースコード

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