Monday, September 21, 2015

UVa 10783 - Odd Sum

// UVa 10783 - Odd Sum
#include <iostream>
#include <stdio.h>
using namespace std;

int main() {
	int tt;
	cin >> tt;
	for (int t = 1; t <= tt; t++) {
		int a, b;
		cin >> a >> b;
		if (a % 2)
			a--;
		if (b % 2)
			b++;
		a = a >> 1;
		b = b >> 1;
		int sol = b * b - a * a;
		printf("Case %d: %d\n", t, sol);
	}
	return 0;
}

No comments:

Post a Comment