fork download
  1. using System;
  2. using System.Collections.Generic;
  3. using System.IO;
  4. using System.Linq;
  5. public class Solution {
  6.  
  7. static void Main(String[] args) {
  8. int t = Convert.ToInt32(Console.ReadLine());
  9. for(int a0 = 0; a0 < t; a0++){
  10. long n = Convert.ToInt32(Console.ReadLine());
  11. Console.WriteLine(Difference(n));
  12. }
  13. }
  14.  
  15. static long Difference(long n)
  16. {
  17. long i= (n*n*n*n +2*n*n*n +n*n)/4;
  18. long j= (2*n*n*n + 3*n*n +n)/6;
  19.  
  20. return i-j;
  21. }
  22. }
Success #stdin #stdout 0.02s 26612KB
stdin
1
100
stdout
25164150