結果
| 問題 |
No.1046 Fruits Rush
|
| コンテスト | |
| ユーザー |
水野嶺
|
| 提出日時 | 2020-05-28 09:21:34 |
| 言語 | Java (openjdk 23) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 498 bytes |
| コンパイル時間 | 2,362 ms |
| コンパイル使用メモリ | 76,316 KB |
| 実行使用メモリ | 55,652 KB |
| 最終ジャッジ日時 | 2024-10-13 04:01:50 |
| 合計ジャッジ時間 | 5,117 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 WA * 2 |
| other | AC * 4 WA * 10 |
ソースコード
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=0;i<n;i++){
fr.add(sc.nextInt());
}
Collections.sort(fr);
for(int i=0;i<k;i++){
if(fr.get(i)>0){
goukei += fr.get(i);
}
}
System.out.println(goukei);
}
}
水野嶺