結果
問題 |
No.5 数字のブロック
|
ユーザー |
![]() |
提出日時 | 2023-12-12 21:39:03 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 314 bytes |
コンパイル時間 | 1,969 ms |
コンパイル使用メモリ | 193,588 KB |
最終ジャッジ日時 | 2025-02-18 10:33:45 |
ジャッジサーバーID (参考情報) |
judge3 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 27 WA * 7 |
ソースコード
#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; }