結果
問題 | No.143 豆 |
ユーザー |
|
提出日時 | 2018-05-11 21:43:22 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 139 ms / 1,000 ms |
コード長 | 595 bytes |
コンパイル時間 | 3,335 ms |
コンパイル使用メモリ | 75,584 KB |
実行使用メモリ | 54,408 KB |
最終ジャッジ日時 | 2024-07-23 10:59:08 |
合計ジャッジ時間 | 6,402 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
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"); } } }