結果
問題 |
No.7 プライムナンバーゲーム
|
ユーザー |
|
提出日時 | 2018-12-20 00:33:52 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 380 bytes |
コンパイル時間 | 711 ms |
コンパイル使用メモリ | 75,068 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-09-25 08:18:14 |
合計ジャッジ時間 | 1,509 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | WA * 17 |
ソースコード
#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; }