結果
問題 | No.1046 Fruits Rush |
ユーザー |
![]() |
提出日時 | 2020-05-28 09:21:01 |
言語 | Java (openjdk 23) |
結果 |
WA
|
実行時間 | - |
コード長 | 500 bytes |
コンパイル時間 | 2,348 ms |
コンパイル使用メモリ | 76,732 KB |
実行使用メモリ | 51,712 KB |
最終ジャッジ日時 | 2024-10-13 04:01:14 |
合計ジャッジ時間 | 5,205 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 WA * 2 |
other | WA * 13 RE * 1 |
ソースコード
import java.util.*; import java.lang.*; import java.io.*; class Main { public static void main (String[] args) { // 入力値の読み込み Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int k = sc.nextInt(); int goukei =0; ArrayList<Integer> fr = new ArrayList<>(); for(int i=1;i==n;i++){ fr.add(sc.nextInt()); } Collections.sort(fr); for(int i=1;i==k;i++){ if(fr.get(i)>0){ goukei += fr.get(i); } } System.out.println(goukei); } }