結果
問題 |
No.143 豆
|
ユーザー |
![]() |
提出日時 | 2016-01-19 22:06:03 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 56 ms / 1,000 ms |
コード長 | 865 bytes |
コンパイル時間 | 1,900 ms |
コンパイル使用メモリ | 74,824 KB |
実行使用メモリ | 50,408 KB |
最終ジャッジ日時 | 2024-07-23 10:25:30 |
合計ジャッジ時間 | 3,478 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 17 |
ソースコード
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Main { public static void main(String[] args) { BufferedReader stdReader =new BufferedReader(new InputStreamReader(System.in)); try { String[] temps = stdReader.readLine().split(" "); int k=Integer.parseInt(temps[0]); int n=Integer.parseInt(temps[1]); int f=Integer.parseInt(temps[2]); int sumBeans = k*n; String[] temps2 = stdReader.readLine().split(" "); int sumAge = 0; for(int i=0;i<temps2.length;i++){ sumAge+=Integer.parseInt(temps2[i]); } if(sumBeans-sumAge>=0){ System.out.println(sumBeans-sumAge); }else{ System.out.println(-1); } } catch (IOException e) { e.printStackTrace(); } } }