結果
| 問題 |
No.5 数字のブロック
|
| ユーザー |
kurokoji
|
| 提出日時 | 2016-05-18 21:20:25 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 3 ms / 5,000 ms |
| コード長 | 1,703 bytes |
| コンパイル時間 | 1,158 ms |
| コンパイル使用メモリ | 161,416 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-11-18 08:36:20 |
| 合計ジャッジ時間 | 2,063 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 34 |
ソースコード
/* {{{ Shinobu kawaii */
/*
______ __ _ __
.' ____ \ [ | (_) [ |
| (___ \_| | |--. __ _ .--. .--. | |.--. __ _
_.____`. | .-. | [ | [ `.-. |/ .'`\ \| '/'`\ \[ | | |
| \____) | | | | | | | | | | || \__. || \__/ | | \_/ |,
\______.'[___]|__][___][___||__]'.__.'[__;.__.' '.__.'_/
*/
/* }}} */
#include <bits/stdc++.h>
using namespace std;
// #define int long long
/* cpp template {{{ */
/* short */
#define pb push_back
#define mp make_pair
#define print(x) cout << x << '\n'
#define Fi first
#define Se second
/* REPmacro */
#define REPS(i, a, n) for (int i = (a); i < (n); i++)
#define REP(i, n) for (int i = 0; i < (n); i++)
#define RREP(i, n) for (int i = 1; i <= (n); i++)
#define DEPS(i, a, n) for (int i = (a); i >= n; i--)
#define DEP(i, n) for (int i = (n); i >= 0; i--)
/* typedef */
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vector<int> > vii;
typedef pair<int, int> pii;
/* const */
const int INF = 999999999;
const int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0};
/* func */
inline bool is_uruu(int y) {return (y % 4 == 0 && (y % 100 != 0 || y % 400 == 0));}
inline bool inside(int y, int x, int H, int W) {return (y >= 0 && x >= 0 && y < H && x < W);}
/* }}} */
signed main()
{
ios::sync_with_stdio(false);
int L, N;
cin >> L >> N;
vi block(N);
REP(i, N) cin >> block[i];
sort(block.begin(), block.end());
int ans = 0;
REP(i, N){
if (L >= block[i]){
L -= block[i];
ans++;
} else break;
}
print(ans);
return (0);
}
kurokoji