結果
問題 |
No.5 数字のブロック
|
ユーザー |
![]() |
提出日時 | 2016-09-06 18:34:51 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 434 bytes |
コンパイル時間 | 777 ms |
コンパイル使用メモリ | 67,612 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-11-15 20:37:06 |
合計ジャッジ時間 | 1,815 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 24 WA * 10 |
ソースコード
#include <iostream> #include <string> #include <vector> #include <algorithm> #include <fstream> int main(void) { //test用 //std::ifstream in("test.txt"); //std::cin.rdbuf(in.rdbuf()); int L, N; std::cin >> L >> N; std::vector<int> W(N); for (int i = 0; i < N; i++) { std::cin >> W[i]; } std::sort(W.begin(), W.end()); int max = 0; int i = 0; while ((max += W[i]) <= L) { i++; } std::cout << i << std::endl; }