結果
問題 |
No.5 数字のブロック
|
ユーザー |
![]() |
提出日時 | 2015-09-02 14:55:45 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 365 bytes |
コンパイル時間 | 402 ms |
コンパイル使用メモリ | 59,840 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-07-18 17:50:47 |
合計ジャッジ時間 | 1,251 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 24 WA * 10 |
ソースコード
#include <algorithm> #include <iostream> #include <string> using namespace std; int main(){ int L, N, nowL = 0, W[10001]; cin >> L >> N; for (int i = 0; i < N; i++) cin >> W[i]; sort(W, W+N); for (int i = 0; i < N; i++){ if ((nowL + W[i]) <= L){ nowL += W[i]; } else{ cout << i << endl; return 0; } } cout << N - 1<< endl; return 0; }