結果
問題 |
No.5 数字のブロック
|
ユーザー |
![]() |
提出日時 | 2018-01-07 12:40:31 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 618 bytes |
コンパイル時間 | 530 ms |
コンパイル使用メモリ | 70,324 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-12-23 09:57:30 |
合計ジャッジ時間 | 1,391 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 7 WA * 27 |
ソースコード
#include <iostream> #include <math.h> #include <algorithm> #include <functional> #include <vector> #include <typeinfo> #include <climits> using namespace std; #define INIT cin.tie(0); ios::sync_with_stdio(false); #define FOR(i, a, n) for (int i = a; i < n; i++) #define REP(i, n) for(int i = 0; i < n; i++) int main() { INIT; int l, n; cin >> l >> n; int W[n]; REP(i, n) cin >> W[i]; sort(W, W + n); int ans = 0, i = 0, c = 1; while(1){ ans += W[i]; if(ans >= l){ break; } i++; c++; } cout << c << endl; return 0; }