SPOJ TRICOUNT Solution

| July 01, 2015

The correct, optimal and working solution for programming question TRICOUNT on spoj

#include <stdio.h>

int main( int argc , char * argv[] ) {

	int t ;

	scanf("%d" , &t);

	while ( t-- ) {
		long long int n;
		scanf("%lld" , &n);
		printf("%lld\n" , (n*(n+2)*(2*n+1))/8 );
	}

	return 0;
}