結果
問題 | No.5 数字のブロック |
ユーザー |
![]() |
提出日時 | 2017-07-21 21:46:15 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
RE
|
実行時間 | - |
コード長 | 357 bytes |
コンパイル時間 | 789 ms |
コンパイル使用メモリ | 76,332 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-10-09 03:41:37 |
合計ジャッジ時間 | 3,527 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 24 RE * 10 |
ソースコード
#include<iostream> #include<string> #include<vector> #include<algorithm> using namespace std; int main(){ int L, N; vector<double> W; double x; cin >> L >> N; for (int i = 0; i < N; i++){ cin >> x; W.push_back(x); } sort(W.begin(), W.end()); double SAM=0.0; int i = 0; while (SAM <= L){ SAM += W[i]; i++; } cout << i-1 << endl; }