标签:while long tps div ref bsp rate contest using
题目链接:https://codeforces.com/contest/1380/problem/C
给 $n$ 个数分组,要求每组的最小值乘以该组数的个数不小于 $x$ 。
从大到小依次分即可。
#include <bits/stdc++.h> using ll = long long; using namespace std; void solve() { int n, x; cin >> n >> x; int a[n] = {}; for (int i = 0; i < n; i++) cin >> a[i]; sort(a, a + n); int ans = 0; ll num = 1; for (int i = n - 1; i >= 0; i--) { if (num * a[i] >= x) { ++ans; num = 1; } else ++num; } cout << ans << "\n"; } int main() { int t; cin >> t; while (t--) solve(); }
Educational Codeforces Round 91 (Rated for Div. 2) C. Create The Teams
标签:while long tps div ref bsp rate contest using
原文地址:https://www.cnblogs.com/Kanoon/p/13296636.html