結果
| 問題 |
No.143 豆
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-04-28 14:23:49 |
| 言語 | Java (openjdk 23) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 568 bytes |
| コンパイル時間 | 2,306 ms |
| コンパイル使用メモリ | 74,332 KB |
| 実行使用メモリ | 54,512 KB |
| 最終ジャッジ日時 | 2024-11-17 14:45:46 |
| 合計ジャッジ時間 | 4,868 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 10 WA * 7 |
ソースコード
import java.util.Scanner;
import java.util.Arrays;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int a = sc.nextInt();
int b = sc.nextInt();
int sumBeans = a*b;
int c = sc.nextInt();
int eatSumBeans = 0;
int [] familyNumber = new int[c];
for(int i = 0; i<familyNumber.length; i++){
int d = sc.nextInt();
eatSumBeans= eatSumBeans+d;
}
int result = sumBeans - eatSumBeans;
if(result <= 0){
System.out.println(-1);
}
System.out.println(result);
}
}