Quantcast
Channel: CodeChef Discuss - latest questions
Viewing all articles
Browse latest Browse all 39796

what is wrong with my code?...i got WA...its the question from june cook-off

$
0
0

include<cstdio>

include<iostream>

include<cmath>

include<algorithm>

include<cstring>

include<sstream>

include<utility>

include<set>

include<cstdlib>

include<vector>

include<map>

include<cctype>

define FOR(a,b) for(int f=a;f<=b-1;f++)//for b-a times iteration in forward

define ROF(a,b) for(int r=a;r>b;r--)//for a-b times iteration in reverse

define PB(n) push_back(n)

define VI vector<int>

define P pair<int,int>

define MP(a,b) make_pair(a,b)

define LLI long long int

define iss istringstream

define F first

define S second

using namespace std;

LLI ans;

int main(){

int t;

scanf("%d",&t);

for(int y=0;y<=t-1;y++){

    int n;

    scanf("%d",&n);

    ans=2*n*n*n*n-7*n*n*n+9*n*n-4*n;//simplified form for 2*n*(n-1)*(n-1)+n*(n-1)*(n-2)+2*n*(n-1)*(n-2)*(n-2)

    printf("%lld\n",ans);

}

}


Viewing all articles
Browse latest Browse all 39796

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>