結果
問題 |
No.5 数字のブロック
|
ユーザー |
![]() |
提出日時 | 2019-10-20 16:02:11 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 5 ms / 5,000 ms |
コード長 | 353 bytes |
コンパイル時間 | 503 ms |
コンパイル使用メモリ | 58,460 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-02 17:27:23 |
合計ジャッジ時間 | 1,649 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 34 |
ソースコード
#include <iostream> #include <algorithm> using namespace std; int l,n; int w[10000]; int main(){ cin>>l>>n; for(int i=0;i<n;i++)cin>>w[i]; sort(w,w+n); int ans=0; while(l>=0){ l-=w[ans]; ans++; if(ans>n){ cout<<n<<endl; return 0; } } cout<<ans-1<<endl; return 0; }