結果
問題 | No.5 数字のブロック |
ユーザー |
![]() |
提出日時 | 2017-06-28 23:15:05 |
言語 | C++11 (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 635 bytes |
コンパイル時間 | 1,332 ms |
コンパイル使用メモリ | 162,848 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-10-04 15:02:12 |
合計ジャッジ時間 | 2,042 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 27 WA * 7 |
ソースコード
#include<bits/stdc++.h> using namespace std; #define FOR(i, a, b) for(int i = (a); i < (int)(b); ++i) #define rep(i, n) FOR(i, 0, n) #define ALL(v) v.begin(), v.end() #define REV(v) v.rbegin(), v.rend() #define MEMSET(v, s) memset(v, s, sizeof(v)) #define UNIQUE(v) (v).erase(unique(ALL(v)), (v).end()) #define MP make_pair #define MT make_tuple int main(){ int L, N, t; vector<int> w; cin >> L; cin >> N; rep(i, N) { cin >> t; w.push_back(t); } sort(ALL(w)); int cnt = 0; for(int a: w) { L -= a; if(L > 0){ cnt += 1; } else { break; } } cout << cnt << endl; return 0; }