結果

問題 No.143 豆
ユーザー 8130Tsk8130Tsk
提出日時 2015-07-24 21:51:11
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 408 bytes
コンパイル時間 5,188 ms
コンパイル使用メモリ 72,692 KB
実行使用メモリ 56,388 KB
最終ジャッジ日時 2023-09-22 22:21:10
合計ジャッジ時間 6,868 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 120 ms
56,000 KB
testcase_01 AC 128 ms
56,228 KB
testcase_02 AC 127 ms
56,212 KB
testcase_03 AC 126 ms
55,632 KB
testcase_04 AC 127 ms
55,744 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 129 ms
55,876 KB
testcase_09 AC 130 ms
55,912 KB
testcase_10 AC 130 ms
55,860 KB
testcase_11 AC 126 ms
55,960 KB
testcase_12 AC 129 ms
56,076 KB
testcase_13 AC 131 ms
56,272 KB
testcase_14 AC 129 ms
55,960 KB
testcase_15 AC 130 ms
55,720 KB
testcase_16 AC 121 ms
56,136 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class No143 {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		int K = sc.nextInt();
		int N = sc.nextInt();
		int F = sc.nextInt();
		
		int sum=K*N;
		
		for(int i=0; i<F;i++){
			if(sum>=0){
				sum=sum-sc.nextInt();
			}else{
				System.out.println(-1);
			}
		}
		System.out.println(sum);
		
	}

}
0