跳到正文

个人记录

刘浩宇是gay

#SUSPENDED#约 1 分钟
原文
文章信息与版本

文章信息

发布
2026年9月26日
收录
2026年9月26日
更新
2026年11月16日
篇幅
约 1 分钟

版本

  1. v2当前
  2. v1
C++
#include <bits/stdc++.h>
using namespace std;
int n,t,a[105],ans;
bool dp[25005];
int main()
{
	cin >> t;
	while(t--)
	{
		cin >> n;
		ans=n;
		dp[0]=1;
		for(int i=1; i<=n; i++)
		{
			cin >> a[i];
		}
		sort(a+1,a+n+1);
		for(int i=1; i<=n; i++)
		{
			if(dp[a[i]]) ans--;
			else
			{
				for(int j=a[i]; j<=a[n]; j++)
				{
					dp[j]|=dp[j-a[i]];
				}
			}
		}
		cout << ans << endl;
		memset(dp,0,sizeof(dp));
	}
return 0;
}

刘浩宇被支付了

原文