結果
問題 | No.5 数字のブロック |
ユーザー |
![]() |
提出日時 | 2015-01-10 18:28:23 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 4 ms / 5,000 ms |
コード長 | 716 bytes |
コンパイル時間 | 952 ms |
コンパイル使用メモリ | 84,604 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-11-17 22:16:43 |
合計ジャッジ時間 | 1,682 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 34 |
ソースコード
#include <iostream> #include <cstdio> #include <string> #include <sstream> #include <algorithm> #include <math.h> #include <map> #include <iomanip> #include <vector> #include <queue> #include <set> #define PI 3.14159265359 #define INF 99999999; #define rep(i, n) for(int i=0; i<n; i++) #define REP(n) rep(i, n) #define EPS 1e-10 typedef long long ll; using namespace std; /* class Target { public: vector <string> draw(int n) { } }; */ int main() { int L, N, width = 0; cin >> L >> N; int W[N]; REP(N) cin >> W[i]; sort(W, W + N); int i; for (i=0; i<N; i++) { width += W[i]; if (width > L) break; } cout << i << endl; //テスト出力 //REP(N) cout << W[i] << " "; return 0; }