結果
| 問題 |
No.5 数字のブロック
|
| ユーザー |
arrows
|
| 提出日時 | 2015-06-02 21:21:13 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 4 ms / 5,000 ms |
| コード長 | 403 bytes |
| コンパイル時間 | 1,345 ms |
| コンパイル使用メモリ | 159,968 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-11-17 22:48:19 |
| 合計ジャッジ時間 | 2,282 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 34 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#define MAX_N 10000
int main(){
int L,N,W[MAX_N];
cin >> L >> N;
for(int i = 0 ; i < N ; i++){
cin >> W[i];
}
sort(W,W+N);
int sum = 0;
bool ok = false;
for(int i = 0 ; i < N ; i++){
sum += W[i];
if(sum > L){
ok = true;
cout << i << endl;
break;
}
}
if(!ok){
cout << N << endl;
}
return 0;
}
arrows