結果
問題 | No.5 数字のブロック |
ユーザー |
![]() |
提出日時 | 2020-06-17 21:36:46 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 5 ms / 5,000 ms |
コード長 | 404 bytes |
コンパイル時間 | 1,432 ms |
コンパイル使用メモリ | 169,284 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-07-03 12:28:13 |
合計ジャッジ時間 | 2,350 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 34 |
ソースコード
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<ll,ll> P; ll l,n,w[10005]; ll ans; int main(void){ cin>>l>>n; for(int i=0;i<n;i++){ cin>>w[i]; } sort(w,w+n); ll i=0; while(l>=0){ if(i==n){ cout<<ans<<endl; return 0; } ans++; l-=w[i]; i++; } cout<<ans-1<<endl; }