\(\color{green}{solution}\)
设
\[b_{i}=2^{w_{i}},sum= \sum_{i=1}^{n}{w_{i}}\]
则对于任意\(a_{i}\)都有
\[a_{i} \times w_{i} \ge sum\]
\[\frac{w_{i}}{sum} \ge \frac{1}{a_{i}}\]
又因为\(w_{i}\)与\(a_{i}\)均为正整数,所以有
\[ \sum_{i=1}^{n} {\frac{w_{i}}{sum}} \ge \sum_{i=1}^{n}{\frac{1}{a_{i}}} \]
化简得到
\[ 1 \ge \sum_{i=1}^{n}{ \frac{1}{a_{i}}} \]
#include <bits/stdc++.h>
using namespace std;
const double eps = 1e-5;
int T, n;
int main() {
scanf("%d", &T);
while ( T -- ) {
scanf("%d", &n);
double ret = 0;
for ( register int i = 1, x; i <= n; ++ i) {
scanf("%d", &x); ret += 1.0 / x;
}
if( ret - 1.0 > eps) puts("NO");
else puts("YES");
}
return 0;
}