Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace Teleport_Points
- {
- class Program
- {
- static void Main(string[] args)
- {
- var point1 = Console.ReadLine().Split(' ');
- var point2 = Console.ReadLine().Split(' ');
- var point3 = Console.ReadLine().Split(' ');
- var point4 = Console.ReadLine().Split(' ');
- var radius = double.Parse(Console.ReadLine());
- var step = double.Parse(Console.ReadLine());
- var count = 0;
- //down left side.
- count +=CalculatePoints(point1[0], point1[1], radius, step);
- count +=CalculatePoints(point2[0], point2[1], radius, step);
- count +=CalculatePoints(point3[0], point3[1], radius, step);
- count +=CalculatePoints(point4[0], point4[1], radius, step);
- Console.WriteLine(count);
- }
- private static int CalculatePoints(string x, string y, double radius, double step)
- {
- var pointX = Math.Abs(double.Parse(x));
- var pointY = Math.Abs(double.Parse(y));
- var count = 0;
- for (double i = 0; i < radius; i+=step)
- {
- for (double k = step; k < radius; k+=step)
- {
- if (i*i +k*k <radius*radius)
- {
- if (pointX<=i||pointY<=k)
- {
- continue;
- }
- count++;
- }
- }
- }
- Console.WriteLine(count);
- return count;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment