Monday 21 January 2013

1724. Counting Triangles Problem code: TRICOUNT

#include<stdio.h>
int main()
{
        long long int test,n;
        scanf("%lld",&test);
        while(test--)
            scanf("%lld",&n)&&printf("%lld\n",n*(n+2)*(2*n+1)/8);
        return 0;
}

No comments:

Post a Comment