結果
問題 | No.5 数字のブロック |
ユーザー |
![]() |
提出日時 | 2019-12-12 22:41:11 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
RE
|
実行時間 | - |
コード長 | 561 bytes |
コンパイル時間 | 1,648 ms |
コンパイル使用メモリ | 168,660 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-06-25 19:50:37 |
合計ジャッジ時間 | 5,322 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 16 RE * 18 |
ソースコード
#include <bits/stdc++.h> using namespace std; typedef long long int ll; typedef pair<ll, ll> pll; #define FOR(i, n, m) for(ll (i)=(m);(i)<(n);++(i)) #define REP(i, n) FOR(i,n,0) #define OF64 std::setprecision(10) const ll MOD = 1000000007; const ll INF = (ll) 1e15; ll W[105]; int main() { ll L, N; cin >> L >> N; REP(i, N) { cin >> W[i]; } sort(W, W + N); ll sum = 0; ll ans = 0; REP(i, N) { sum += W[i]; if (sum > L) break; ans++; } cout << ans << endl; return 0; }