Saturday, July 16, 2016

Published July 16, 2016 by with 0 comment

UVA 13108 Solution

#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;
}
      edit

0 comments:

Post a Comment