fork(9) download
  1. using System;
  2. using System.Collections.Generic;
  3.  
  4. public class Program
  5. {
  6. private static void Test(int R)
  7. {
  8. int x0 = 0, y0 = 0, n = 360;
  9. var pts = new HashSet<Tuple<int, int>>();
  10.  
  11. for (int i = 0; i < n; ++i)
  12. {
  13. int x = (int)(Math.Cos(2 * Math.PI * i / n) * R + 0.5) + x0;
  14. int y = (int)(Math.Sin(2 * Math.PI * i / n) * R + 0.5) + y0;
  15.  
  16. pts.Add(new Tuple<int, int>(x, y));
  17. }
  18.  
  19. Console.WriteLine("{0} of {1} when radius is {2}", pts.Count, n, R);
  20. }
  21.  
  22. public static void Main()
  23. {
  24. Test(1);
  25. Test(10);
  26. Test(20);
  27. Test(40);
  28. Test(80);
  29. Test(90);
  30. Test(100);
  31. }
  32. }
Success #stdin #stdout 0.04s 24056KB
stdin
Standard input is empty
stdout
4 of 360 when radius is 1
76 of 360 when radius is 10
140 of 360 when radius is 20
268 of 360 when radius is 40
356 of 360 when radius is 80
360 of 360 when radius is 90
360 of 360 when radius is 100