#include <iostream> #include <vector> #include <algorithm> using namespace std; int main() { long long n, x, totalCoins; cin >> n >> x; totalCoins = x; vector<int> a(n); for (int i = 0; i < n; ++i) { cin >> a[i]; } sort(a.begin(), a.end()); long long count = 0; for (int i = 0; i < n; ++i) { if (x >= a[i]) { count++; } else { break; } } if (count == 0) { cout << count << " " << x << endl; } else { cout << count << " " << totalCoins - x << endl; } return 0; }
}
全部评论
(4) 回帖