Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- #define sunil ios::sync_with_stdio(0);cin.tie(0); cout.tie(0)
- using namespace std;
- int main()
- {
- sunil;
- int t;
- cin>>t;
- while(t--){
- int n,j;
- cin>>n;
- long long x,ans=0,mvs=1;
- for(int i=3;i<=n;i+=2){
- j=i-2;
- ans+=(i*i - j*j)*mvs;
- mvs++;
- }
- cout<<ans<<endl;
- }
- }
Add Comment
Please, Sign In to add comment