結果
問題 |
No.5 数字のブロック
|
ユーザー |
![]() |
提出日時 | 2018-07-14 21:29:17 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 4 ms / 5,000 ms |
コード長 | 424 bytes |
コンパイル時間 | 597 ms |
コンパイル使用メモリ | 68,052 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-18 12:31:53 |
合計ジャッジ時間 | 1,437 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 34 |
ソースコード
#include<iostream> #include<string> #include<algorithm> #include<vector> #include<queue> #include<stack> #include<cmath> #include<cstdlib> #include<ctime> using namespace std; typedef long long ll; int main() { int l, n, a[10010], ans = 0; cin >> l >> n; for (int i = 0; i < n; i++)cin >> a[i]; sort(a, a + n); for (int i = 0; i < n; i++) { l -= a[i]; if (l < 0)break; ans++; } cout << ans << endl; return 0; }