UVA10790- How Many Points of Intersection?

推公式。。。a * (a - 1) * b * (b - 1) / 4;

#include<stdio.h>

int main() {
	long long a, b, t = 0;
	while (scanf("%lld%lld", &a, &b) && a && b) {
		long long cnt = 0;	
		cnt = a * (a - 1) * b * (b - 1) / 4; 
		printf("Case %lld: %lld\n", ++t, cnt) ;	
	}
	return 0;
}



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