fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. #define ll long long
  4. int tt, tc;
  5.  
  6. const int N = 101;
  7. int dp[N][N];
  8.  
  9. void solve() {
  10. int n;
  11. cin >> n;
  12. for (int i = 1; i <= n; i++)
  13. for (int j = 1; j <= n; j++) {
  14. dp[i][j] = max(dp[i - 1][j], dp[i][j - 1]) + i * j;
  15. }
  16. cout << dp[n][n] << "\n";
  17. }
  18.  
  19. int main() {
  20. ios::sync_with_stdio(0); cin.tie(0);
  21. tt = 1, tc = 1; cin >> tt;
  22. while (tt--) solve(), tc++;
  23. }
  24.  
Success #stdin #stdout 0.01s 5516KB
stdin
Standard input is empty
stdout
0