結果
問題 |
No.5 数字のブロック
|
ユーザー |
|
提出日時 | 2021-03-10 01:36:04 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 406 bytes |
コンパイル時間 | 1,654 ms |
コンパイル使用メモリ | 170,576 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-11 16:50:53 |
合計ジャッジ時間 | 2,721 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 27 WA * 7 |
ソースコード
#include<bits/stdc++.h> using namespace std; int main(){ int L,N; cin>> L >> N; vector<int> wide(N); for(int i=0;i<N;i++){ cin >> wide[i]; } sort(wide.begin(),wide.end()); int count = 0; int ans = 0; for(int i=0;i<N;i++){ count += wide[i]; if(count >= L){ break; } ans++; } cout << ans << endl; }