結果
問題 |
No.5 数字のブロック
|
ユーザー |
![]() |
提出日時 | 2018-02-19 23:10:38 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 404 bytes |
コンパイル時間 | 501 ms |
コンパイル使用メモリ | 60,040 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-07-16 03:52:33 |
合計ジャッジ時間 | 1,464 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 27 WA * 7 |
ソースコード
#include<iostream> #include<algorithm> #define DEBUG #define NMAX 10000 using namespace std; int main(){ int L; int N; int W[NMAX]; int c; cin>>L; cin>>N; for(int i=0;i<N;i++){ cin>>W[i]; } sort(W,W+N); c=0; for(int i=0;i<N;i++){ if(W[i]<L){ L-=W[i]; c++; } else break; } cout<<c<<endl; }