Saturday, July 16, 2016

UVA 13108 Solution

Unknown
#include<cstdio>
#include<cmath>
using namespace std;

int main()
{
    int t,n;
    scanf("%d",&t);
    while (t--)
    {
        scanf("%d",&n);
        int ans=n*(n-1)/2+n*(n-1)*(n-2)*(n-3)/24+1;
        printf("%d\n",ans);
    }
    return 0;
}

Unknown

Studying at Shahjalal University of Science and Technology, Sylhet.

0 comments:

Post a Comment

Coprights @ 2016,