結果
| 問題 | No.143 豆 |
| コンテスト | |
| ユーザー |
samplelpmas
|
| 提出日時 | 2016-11-09 11:51:48 |
| 言語 | Java (openjdk 25.0.2) |
| 結果 |
AC
|
| 実行時間 | 61 ms / 1,000 ms |
| コード長 | 570 bytes |
| 記録 | |
| コンパイル時間 | 1,506 ms |
| コンパイル使用メモリ | 82,128 KB |
| 実行使用メモリ | 46,512 KB |
| 最終ジャッジ日時 | 2026-04-03 13:53:44 |
| 合計ジャッジ時間 | 3,171 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 17 |
ソースコード
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int numBeansPerPack = sc.nextInt();
int numPacks = sc.nextInt();
int numPeople = sc.nextInt();
int numLeftovers = numBeansPerPack * numPacks;
for (int i = 0; i < numPeople; i++) {
int age = sc.nextInt();
numLeftovers -= age;
}
if (numLeftovers < 0) {
numLeftovers = -1;
}
System.out.println(numLeftovers);
}
}
samplelpmas