fork download
  1. using System;
  2. using System.Collections.Generic;
  3. using System.IO;
  4. class Solution {
  5. static void Main(String[] args)
  6. {
  7. /* Enter your code here. Read input from STDIN. Print output to STDOUT. Your class should be named Solution */
  8. int[] arr = new int[1001];
  9. int temp = 0, box = 0;
  10. for (int i = 1; i <= 600; i++)
  11. {
  12. while (temp <= i)
  13. {
  14. box++;
  15. temp = Factor(box * (box + 1) / 2);
  16. }
  17. arr[i] = box * (box + 1) / 2;
  18. }
  19. int test = Convert.ToInt32(Console.ReadLine());
  20. while (test-- > 0)
  21. {
  22. int n = Convert.ToInt32(Console.ReadLine());
  23. Console.WriteLine(arr[n]);
  24. }
  25. }
  26. static int Factor(int a)
  27. {
  28. int count = 0;
  29. if (a == 1)
  30. {
  31. return 1;
  32. }
  33. for (int i = 1; i < Math.Ceiling(Math.Sqrt(a)); i++)
  34. {
  35. if (a % i == 0)
  36. {
  37. count += 2;
  38. }
  39. }
  40. if (Math.Ceiling(Math.Sqrt(a)) == Math.Floor(Math.Sqrt(a)))
  41. {
  42. count++;
  43. }
  44. return count;
  45. }
  46. }
  47.  
Success #stdin #stdout 0.85s 24568KB
stdin
1
500
stdout
76576500