結果
| 問題 |
No.156 キャンディー・ボックス
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2019-07-26 19:49:46 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 9 ms / 2,000 ms |
| コード長 | 313 bytes |
| コンパイル時間 | 1,978 ms |
| コンパイル使用メモリ | 195,764 KB |
| 最終ジャッジ日時 | 2025-01-07 07:37:14 |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 30 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
int n, m;
cin>>n>>m;
int a[n];
for (int i = 0; i < n; i++) cin >> a[i];
sort(a,a+n);
int i;
for (i=0; i<n; i++) {
m -= a[i];
if (m < 0) break;
}
cout << i << endl;
return 0;
}