結果
問題 |
No.143 豆
|
ユーザー |
|
提出日時 | 2019-06-12 14:40:10 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 146 ms / 1,000 ms |
コード長 | 452 bytes |
コンパイル時間 | 2,011 ms |
コンパイル使用メモリ | 73,944 KB |
実行使用メモリ | 54,432 KB |
最終ジャッジ日時 | 2024-07-23 11:15:01 |
合計ジャッジ時間 | 5,183 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 17 |
ソースコード
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int bean = sc.nextInt(); int pack = sc.nextInt(); int family = sc.nextInt(); int total = 0; for(int i=0;i<family;i++){ int old = sc.nextInt(); total += old ; } sc.close(); if(bean*pack>=total){ System.out.println(bean*pack-total); }else{ System.out.println(-1); } }// mainmethod } // class