Problem:
https://www.hackerearth.com/algorithms-qualifiers-round-2/algorithm/cube-change-qualifier2/Solution:
int main(){
int t;
scanf("%d",&t);
while(t--){
long long int v,n;
scanf("%lld",&n);
if(n==1)
v=1;
else
v=(2*n*n)+(2*n*(n-2))+(2*(n-2)*(n-2));
printf("%lld\n",v);
}
return 0;
}
No comments:
Post a Comment