結果
問題 |
No.5 数字のブロック
|
ユーザー |
|
提出日時 | 2018-07-14 00:49:33 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 5 ms / 5,000 ms |
コード長 | 576 bytes |
コンパイル時間 | 1,607 ms |
コンパイル使用メモリ | 168,840 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-18 12:31:50 |
合計ジャッジ時間 | 2,528 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 34 |
ソースコード
#include "bits/stdc++.h" using namespace std; typedef long long ll; #define INF (1<<30) #define INFLL (1ll<<60) typedef pair<double, int> P; typedef pair<int, P> E; #define MOD (1000000007ll) #define l_ength size #define EPS (1e-10) void add_mod(ll &a, ll b){ a += b; a %= MOD; } void mul_mod(ll &a, ll b){ a *= b; a %= MOD; } int main(void){ int l,n,w[12345],i; cin >> l; cin >> n; for(i=0; i<n; ++i){ cin >> w[i]; } sort(w,w+n); for(i=1; i<n; ++i){ w[i] += w[i-1]; if(w[i] > l){ cout << i << endl; return 0; } } cout << n << endl; return 0; }