Source Code
#include<bits/stdc++.h>
using namespace std;
int main(){
      int t;
      cin >> t;
      for(int i =0; i <t; i++){
          int n, sum = 0;
          cin >> n;
          for(int j =1;  j <= n;j++){
              sum+= (j-1)*n +j;
          }
          cout << sum << endl;
      }
}
Copy
Ali's Game Oj3far
GNU G++17
2004 ms
1.1 MB
Time Limit Exceeded