結果
| 問題 |
No.5 数字のブロック
|
| ユーザー |
nonon
|
| 提出日時 | 2023-12-12 21:39:29 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 3 ms / 5,000 ms |
| コード長 | 315 bytes |
| コンパイル時間 | 1,886 ms |
| コンパイル使用メモリ | 194,572 KB |
| 最終ジャッジ日時 | 2025-02-18 10:33:52 |
|
ジャッジサーバーID (参考情報) |
judge5 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 34 |
ソースコード
#include<bits/stdc++.h>
using namespace std;
int L,N,W[1<<17];
int main()
{
ios::sync_with_stdio(false);
cin.tie(nullptr);
cin>>L>>N;
for(int i=0;i<N;i++)cin>>W[i];
sort(W,W+N);
int ans=0,i=0;
while(i<N&&L-W[i]>=0)
{
L-=W[i++];
ans++;
}
cout << ans << endl;
}
nonon