結果
問題 |
No.5 数字のブロック
|
ユーザー |
![]() |
提出日時 | 2016-04-09 02:06:49 |
言語 | Java (openjdk 23) |
結果 |
RE
|
実行時間 | - |
コード長 | 377 bytes |
コンパイル時間 | 2,296 ms |
コンパイル使用メモリ | 74,212 KB |
実行使用メモリ | 54,912 KB |
最終ジャッジ日時 | 2024-10-04 04:59:34 |
合計ジャッジ時間 | 9,956 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 24 RE * 10 |
ソースコード
import java.util.*; class No5_Yukicoder { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int L = sc.nextInt(); int N = sc.nextInt(); int[] W = new int[N]; for(int i=0; i<N; i++) W[i] = sc.nextInt(); Arrays.sort(W); int work = 0; int ans = 0; while((work+=W[ans]) <= L) { ans++; } System.out.println(ans); } }