Thursday, September 24, 2015

UVa 10790 - How Many Points of Intersection?

// UVa 10790 - How Many Points of Intersection?

#include <iostream>
#include <stdio.h>
using namespace std;

#define datatype unsigned long long int

int main() {
	datatype a, b;
	cin >> a >> b;
	int t = 0;
	while (a || b) {
		t++;
		datatype sol = (a * a - a * (a + 1) / 2) * ((b - 1) * b / 2);
		printf("Case %d: %llu\n", t, sol);
		cin >> a >> b;
	}
	return 0;
}

No comments:

Post a Comment