結果
| 問題 |
No.5 数字のブロック
|
| ユーザー |
Kutimoti_T
|
| 提出日時 | 2017-12-17 16:10:56 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 5 ms / 5,000 ms |
| コード長 | 544 bytes |
| コンパイル時間 | 602 ms |
| コンパイル使用メモリ | 69,168 KB |
| 実行使用メモリ | 6,824 KB |
| 最終ジャッジ日時 | 2024-11-18 11:52:18 |
| 合計ジャッジ時間 | 1,656 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 34 |
ソースコード
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <set>
#include <map>
using namespace std;
#define FOR(i,s,e) for(int i = (s);i <= (e);i++)
int L;
int N;
int W[10000];
int main()
{
cin >> L;
cin >> N;
FOR(i,0,N - 1)
{
cin >> W[i];
}
sort(W,W + N);
int now = 0;
FOR(i,0,N - 1)
{
if(now + W[i] > L)
{
cout << i << endl;
return 0;
}
now += W[i];
}
cout << N << endl;
return 0;
}
Kutimoti_T