Advertisement
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 ConsoleApp2
- {
- class Program
- {
- static void Main(string[] args)
- {
- double r,max;
- int i, j,p,p1;
- int[,] array = new int[10, 2];
- for (i = 0; i < 10; i++)
- {
- array[i, 0] = int.Parse(Console.ReadLine());
- array[i, 1] = int.Parse(Console.ReadLine());
- }
- //a
- for ( i=0;i<10; i++)
- {
- Console.WriteLine(array[i, 0] + " " + array[i, 1]);
- }
- Console.WriteLine();
- //b
- for (i = 0; i < 10; i++)
- {
- Console.Write(array[i, 0] + " " + array[i, 1] + " " );
- if (array[i, 0] > 0 && array[i, 1] > 0) Console.WriteLine("kwadrant 1");
- if (array[i, 0] > 0 && array[i, 1] < 0) Console.WriteLine("kwadrant 4");
- if (array[i, 0] < 0 && array[i, 1] > 0) Console.WriteLine("kwadrant 2");
- if (array[i, 0] < 0 && array[i, 1] < 0) Console.WriteLine("kwadrant 3");
- }
- //c
- for (i = 0; i < 10; i++)
- {
- Console.Write(array[i, 0] + " " + array[i, 1] + " ");
- r = Math.Sqrt(Math.Pow(array[i, 0], 2) + Math.Pow(array[i, 1], 2));
- Console.WriteLine("razstoqnieto = " + r);
- }
- //d
- max = 0;p = 0;
- for (i = 0; i < 10; i++)
- {
- r = Math.Sqrt(Math.Pow(array[i, 0], 2) + Math.Pow(array[i, 1], 2));
- if (max < r)
- {
- max = r;
- p = i;
- }
- }
- Console.WriteLine("max razst. = " + max + " na tochka " + p);
- //e
- max = 0; p = 0;p1 = 0;
- for (i = 0; i < 9; i++)
- {
- for (j = i + 1; j < 10; j++)
- {
- r = Math.Sqrt(Math.Pow(array[i, 0] - array[j, 0], 2) - Math.Pow(array[i, 1] - array[j, 1], 2));
- if (max < r)
- {
- p1 = j;
- p = i;
- }
- }
- }
- Console.WriteLine("nai otdalecheni tochki: " + p + " " + p1);
- }
- }
- }
- /*
- 3
- 4
- -1
- 4
- -5
- -4
- 7
- -1
- 10
- 10
- -5
- -2
- -10
- -10
- 7
- -4
- 9
- 9
- 2
- 3
- */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement