My issue
Why come TLE ?
My code
#include <bits/stdc++.h>
using namespace std;
#define ll long long
int main() {
// your code goes here
ios::sync_with_stdio(0);
cin.tie(0);
ll t;
cin>>t;
while(t--)
{
ll n;
cin>>n;
if(n==1)cout<<1<<endl;
else if(n==2 || n==3)cout<<3<<endl;
else
{
ll j=n-3;
ll ans=(8+(j-1)*2)*n/2;
ans+=3;
cout<<ans<<endl;
}
}
}
Learning course: 1600 to 1800 difficulty problems
Problem Link: Odd Sum Practice Problem in - CodeChef