A与不A,也就是一个换行符的距离。。。。。。。。。。。。。。。
(当时如果有换行,是不是还能有信心写下去呢。。?)
事实上还是很可做的
我们设S为Σlogbi,那么显然对于任意 i ,有S <= logbi * ai
因为ai都小等10,那么会发现,当对于每一个logbi均大于10的话,是肯定无解的
于是我们就可以考虑贪心构造logbi,当logbi大于10就break即可
代码:
#include<cstdio>
#include<algorithm>
#include<cstdlib>
#include<vector>
#include<map>
using namespace std;
typedef long long LL;
const int maxn = 100100;
bool flag;
int a[maxn],b[maxn];
int n,sum;
inline LL getint()
{
LL ret = 0;
char c = getchar();
while (c < '0' || '9' < c) c = getchar();
while ('0' <= c && c <= '9')
ret = ret * 10 + c - '0',c = getchar();
return ret;
}
int main()
{
int T = getint();
while (T--)
{
n = getint();
for (int i = 1; i <= n; i++) a[i] = getint();
sort(a + 1,a + n + 1);
for (int i = 1; i <= n; i++) b[i] = 1;
sum = n;
for (int j = 1; j <= 10; j++)
for (int i = 1; i <= n; i++)
while (sum - b[i] * a[i] > 0 && b[i] <= 10)
b[i]++ , sum++;
flag = 0;
for (int i = 1; i <= n; i++)
if (sum - b[i] * a[i] > 0) flag = 1;
if (flag) printf("NO\n");
else printf("YES\n");
}
return 0;
}