Temabowl

Untitled

Nov 13th, 2019
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.35 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using System.Diagnostics;
  7. using System.Threading;
  8. using static System.Math;
  9.  
  10. namespace ConsoleApp1
  11. {
  12. class Program
  13. {
  14. static void Main(string[] args)
  15. {
  16. Stopwatch stopWatch = new Stopwatch();
  17.  
  18. UInt64 math(UInt64 cabbage)
  19. {
  20. if (cabbage <= 2)
  21. {
  22. Console.WriteLine("Кочанов не может быть меньше, чем 3");
  23. return 0;
  24. }
  25. UInt64 hares = Convert.ToUInt64(Sqrt(cabbage));
  26. while (cabbage/hares != cabbage / (hares + 1))
  27. {
  28. hares = hares + 1;
  29. }
  30. return hares;
  31. }
  32.  
  33. UInt64 count = Convert.ToUInt64(Console.ReadLine());
  34. UInt64[] print = new UInt64[count];
  35. for (UInt64 i = 0; i < count; i++)
  36. {
  37. UInt64 n = Convert.ToUInt64(Console.ReadLine());
  38. print[i] = math(n);
  39. }
  40. for (UInt64 i = 0; i < count;i++)
  41. {
  42. Console.WriteLine(print[i]);
  43. }
  44.  
  45.  
  46. Console.ReadKey();
  47.  
  48. }
  49. }
  50. }
Advertisement
Add Comment
Please, Sign In to add comment