結果
問題 |
No.5 数字のブロック
|
ユーザー |
|
提出日時 | 2018-12-20 00:33:40 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 5 ms / 5,000 ms |
コード長 | 380 bytes |
コンパイル時間 | 944 ms |
コンパイル使用メモリ | 74,712 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-11-18 12:44:50 |
合計ジャッジ時間 | 1,512 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 34 |
ソースコード
#include <iostream> #include <vector> #include <algorithm> using namespace std; int main() { int L, N; vector<int> w(10000); cin >> L >> N; for(int i=0; i<N; i++){ cin >> w[i]; } sort(w.begin(), w.begin()+N); int num, sum=0; for(num=0; num<N; num++){ if(sum+w[num]<=L) sum+=w[num]; else break; } cout << num; return 0; }