fork download
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Text;
  4.  
  5. namespace New
  6. {
  7. class Program
  8. {
  9. static void Main(string[] args)
  10. {
  11. long a = Convert.ToInt32(Console.ReadLine());
  12. long b = 1;
  13. long[] c=new long [100000];
  14. long[] d=new long [100000];
  15. c[0] = 0;
  16. while (a % 2 == 0)
  17. {
  18. c[0]+= 1;
  19. d[0]=2;
  20. b = 2;
  21. a /= 2;
  22. }
  23. long k = Convert.ToInt32(d[0]==2);
  24.  
  25. for (int i = 3; a > 1; i = i + 2)
  26. {
  27. if (a % i == 0)
  28. {
  29. k++;
  30. b *= i;
  31. d[k] = i;
  32. c[k] = 0;
  33. while (a % i == 0)
  34. {
  35. a /= i;
  36. c[k] += 1;
  37. }
  38. }
  39. }
  40. long n=1;
  41. for (int i = 0; i < k; i++)
  42. {
  43. if (c[i] > n) {n *= d[i]; i--;}
  44. }
  45. Console.WriteLine(n);
  46. }
  47. }
  48. }
  49.  
Success #stdin #stdout 0.03s 38960KB
stdin
8
stdout
4