結果
問題 | No.5 数字のブロック |
ユーザー | hayaD |
提出日時 | 2015-05-03 18:46:06 |
言語 | C++11 (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 4 ms / 5,000 ms |
コード長 | 448 bytes |
コンパイル時間 | 512 ms |
コンパイル使用メモリ | 71,436 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-11-17 22:42:00 |
合計ジャッジ時間 | 1,386 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 34 |
ソースコード
#include <iostream> #include <iomanip> #include <sstream> #include <string> #include <cmath> #include <iostream> #include <algorithm> using namespace std; int main() { int L,N; cin >> L >> N; int W[10001] = {0}; for (int i = 0;i <N;i++){ cin >> W[i]; } sort(W,W+N); int tmp_L = 0; int count = 0; for (int i=0;i < N;i++){ tmp_L += W[i]; if (tmp_L > L){ break; }else{ count++; } } cout << count << endl; return 0; }