結果
問題 |
No.5 数字のブロック
|
ユーザー |
![]() |
提出日時 | 2018-06-11 16:45:05 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 364 bytes |
コンパイル時間 | 514 ms |
コンパイル使用メモリ | 63,984 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-06-30 13:35:58 |
合計ジャッジ時間 | 1,475 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 24 WA * 10 |
ソースコード
#include <iostream> #include <algorithm> #include <vector> #define rep(i, n) for(int i = 0; i < (int)(n); i++) using namespace std; int main(){ int L,N; cin>>L>>N; vector<int> w(N); rep(i,N){ cin>>w[i]; } sort(w.begin(),w.end()); int count=0,size=0; rep(i,N){ size+=w[i]; count++; if(L<size){ cout<<count-1; return 0; } } return 0; }