結果
問題 |
No.5 数字のブロック
|
ユーザー |
![]() |
提出日時 | 2016-12-09 17:16:15 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 245 ms / 5,000 ms |
コード長 | 537 bytes |
コンパイル時間 | 3,165 ms |
コンパイル使用メモリ | 75,516 KB |
実行使用メモリ | 59,008 KB |
最終ジャッジ日時 | 2024-11-18 10:47:56 |
合計ジャッジ時間 | 9,954 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 34 |
ソースコード
import java.util.*; public class Test { public static void main(String[] args) { Scanner s = new Scanner(System.in); int l = s.nextInt(); int n = s.nextInt(); int w[] = new int[n]; for(int i=0;i<n;i++){ w[i] = s.nextInt(); } Arrays.sort(w); int count = 0; for(int i=0;i<n;i++){ l -= w[i]; if(l >= 0){ count++; } else{ break; } } System.out.println(count); } }