诸位大佬,求助一下,我始终有一个过不去呀,救命呀
查看原帖
诸位大佬,求助一下,我始终有一个过不去呀,救命呀
335860
化身灵蝶子楼主2020/5/24 12:06
#include<stdio.h>
int main()
{
	int num[1000],num1[1000];
	int n, i, j, k, number, add, t = 0,i1,j1,k1;
	scanf("%d", &n);
	for (i = 0; i < n; i++)
	{
		scanf("%d", &num[i]);
	}
	for (j = 0; j < i; j++)
	{
		for (k = j + 1; k < i; k++)
		{
			add = num[j] + num[k];
			for (number = 0; number < i; number++)
			{
				if (num[number] == add)
				{
					num1[t] = add;
					t++; break;
				}
			}
		}
	}
	for (i1 = 1; i1 <= 10000; i1++)
	{
		int x1 = 0;
		for (j1 = 0; j1 < t; j1++)
		{
			if (num1[j1] == i1)
			{
				x1++;
			}
		}
		if(x1!=0)
		t =t - x1 + 1;
	}
	printf("%d", t);
	return 0;
}
2020/5/24 12:06
加载中...