uva-10790-How Many Points of Intersection?

这道题就是一道纯公式题目,数学如果学好来,然后公式推导出来,这道题目就AC来,注意题目要求说的要用long long int;


公式:如果上面有a个点,下面有b个点,那么相交点的数目为:a*(a-1)*b*(b-1)/4;



#include<stdio.h>
int main()
{
	long long  a,b,leap=0;
	while(scanf("%lld%lld",&a,&b)&&(a||b))
	{
		leap++;
		printf("Case %lld: ",leap);
		printf("%lld\n",a*(a-1)*b*(b-1)/4);
	}
	return 0;
}


你可能感兴趣的:(uva-10790-How Many Points of Intersection?)