Kingdom LJJ wedding

Kingdom LJJ wedding

Description
in the Kingdom LJJ, the marriage law, marriage after divorce are not allowed, but you can choose marriage age 1-100 years, equivalent to automatically renew expired without a divorce, but the shorter the higher the cost, 1-year registration fee of more than 1 trillion $ 100 in only 6 yuan. Married one year, you do not understand marriage, so there is a very thick book to look at marriage, and the choice of 100 years only a piece of paper that says one: I wish you both a lifetime!

Suppose the selected limited life of a marriage years, is required to pay a registration fee following formula.

Here Insert Picture Description

Input

A first line of input integer T (1 = <T <= 100)

The following T lines of an integer a (1 = <a <= 100), representing the selected year of marriage

Output

A For each input, output an integer representing the need to pay registration fees

Sample

Input

2
1
100

Output

1702937186220
6

#include <stdio.h>
#include <stdlib.h>

int main()
{
    int i,a,j,k,n,l;
    scanf("%d",&n);
    while(n)
    {
        long long int s=0;
        n--;
        scanf("%d",&a);
        for(i=a; i<=100; i++)
        {
            for(j=i; j<=100; j++)
            {
                for(k=j; k<=100; k++)
                {
                    for(l=k; l<=100; l++)
                        s=s+k*l*l-i*j*j+6*(k-99)*(k-99);
                }
            }
        }
        printf("%lld\n",s);
    }
    return 0;
}

Released two original articles · won praise 0 · Views 12

Guess you like

Origin blog.csdn.net/qq_18924321/article/details/104116941