 # Aptitude(https://www.codechef.com/CBST2021/problems/APTD)

Practice

Author: noob_tech
Tester: noob_tech
Editorialist: noob_tech

# DIFFICULTY:

CAKEWALK, SIMPLE, EASY.

Math .

# PROBLEM:

CodeMaster is given a Series pattern which is increasing in a particular manner.His teacher told him find the Nth term of the series.

2,8,18,32,50,72,….

Help the CodeMaster to find the Nth term of series and print Nth term.

# QUICK EXPLANATION:

We are given a series. If we are observed pattern that it increases in a particular manner i.e( (NN)+(NN) ). So use this formula (NN)+(NN) to find Nth term of series.

# EXPLANATION:

Here, We are given a series who increases in a particular manner i.e. 2,8,18,32,50,72,… We have to find the Nth term of the series.
Lets Consider N=3, For N=3 Output should be 18.
For this particular series we will use (NN)+(NN). That’s (33)+(33)=18.
So output will be 18.

# SOLUTIONS:

Setter's Solution

#include<bits/stdc++.h>
using namespace std;
int main()
{
int t;
cin>>t;
while(t- -)
{
long long n,ans;
cin>>n;
ans=(n * n)+(n * n);
cout<<ans<<endl;
}
return 0;
}

Tester's Solution

#include<bits/stdc++.h>
using namespace std;
int main()
{
int t;
cin>>t;
while(t- -)
{
long long n,ans;
cin>>n;
ans=(n * n)+(n * n);
cout<<ans<<endl;
}
return 0;
}

Editorialist's Solution

#include<bits/stdc++.h>
using namespace std;
int main()
{
int t;
cin>>t;
while(t- -)
{
long long n,ans;
cin>>n;
ans=(n * n)+(n * n);
cout<<ans<<endl;
}
return 0;
}