結果
問題 |
No.143 豆
|
ユーザー |
![]() |
提出日時 | 2015-12-12 16:15:14 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 55 ms / 1,000 ms |
コード長 | 669 bytes |
コンパイル時間 | 2,196 ms |
コンパイル使用メモリ | 74,424 KB |
実行使用メモリ | 50,368 KB |
最終ジャッジ日時 | 2024-07-23 10:24:20 |
合計ジャッジ時間 | 3,639 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 17 |
ソースコード
import java.io.BufferedReader; import java.io.InputStreamReader; public class Main { public static void main(String[] args) { BufferedReader read = new BufferedReader(new InputStreamReader(System.in)); try { String[] line = read.readLine().split(" "); int count = Integer.parseInt(line[0]) * Integer.parseInt(line[1]); int f = Integer.parseInt(line[2]); line = read.readLine().split(" "); int total = 0; for(int i = 0; i < f; ++i){ total += Integer.parseInt(line[i]); } if(total > count){ System.out.println(-1); }else{ System.out.println(count - total); } } catch (Exception e) { e.printStackTrace(); } } }