結果
| 問題 |
No.156 キャンディー・ボックス
|
| コンテスト | |
| ユーザー |
ちよちゃん
|
| 提出日時 | 2016-06-04 13:49:11 |
| 言語 | Java (openjdk 23) |
| 結果 |
AC
|
| 実行時間 | 111 ms / 2,000 ms |
| コード長 | 540 bytes |
| コンパイル時間 | 2,781 ms |
| コンパイル使用メモリ | 77,628 KB |
| 実行使用メモリ | 41,684 KB |
| 最終ジャッジ日時 | 2024-07-05 15:51:37 |
| 合計ジャッジ時間 | 7,274 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 30 |
ソースコード
package yukicoder;
import java.util.Arrays;
import java.util.Scanner;
public class Yuki156 {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int n = scan.nextInt();
int m = scan.nextInt();
int candyBox[] = new int[n];
for (int i = 0; i < n; i++) {
candyBox[i] = scan.nextInt();
}
Arrays.sort(candyBox);
scan.close();
int boxCount = 0;
for (int i = 0; i < n; i++) {
m -=candyBox[i];
if (m >= 0) {
boxCount++;
}
}
System.out.println(boxCount);
}
}
ちよちゃん