本人代码:
#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5;
bitset<maxn+1> S;
int n, x[maxn];
int main() {
cin >> n;
S[0] = 1;
for(int i = 1; i <= n; i++)
cin >> x[i];
sort(x+1, x+n+1);
for(int i = 1; i <= n; i++)
for(int j = x[i]; j <= 1000; j++)
S |= S << x[i];
int ans = 0;
for(int i = 1; i <= x[n]*990; i++)
if(!S.test(i)) ans++;
if(ans > x[n]*500) cout << "INF";
else cout << ans;
return 0;
}