結果
| 問題 | No.143 豆 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2018-05-11 21:43:22 |
| 言語 | Java (openjdk 25.0.2) |
| 結果 |
AC
|
| 実行時間 | 58 ms / 1,000 ms |
| コード長 | 595 bytes |
| 記録 | |
| コンパイル時間 | 3,415 ms |
| コンパイル使用メモリ | 82,532 KB |
| 実行使用メモリ | 41,980 KB |
| 最終ジャッジ日時 | 2026-04-03 13:59:23 |
| 合計ジャッジ時間 | 4,015 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 17 |
ソースコード
import java.util.Scanner;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class Setsubun{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
int K = sc.nextInt();
int N = sc.nextInt();
int num_beans = K*N;
int F = sc.nextInt();
int num_eats = 0;
for(int i = 0; i < F; i++){
num_eats += sc.nextInt();
}
if(num_beans >= num_eats){
System.out.println(num_beans - num_eats);
}else{
System.out.println("-1");
}
}
}