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;
- using static System.Math;
- namespace ConsoleApp1
- {
- class Program
- {
- static void Main(string[] args)
- {
- int math(int cabbage)
- {
- if (cabbage <= 2)
- {
- return 1;
- }
- int hares = Convert.ToInt32(Sqrt(cabbage));
- while (cabbage/hares != cabbage / (hares + 1))
- {
- hares = hares + 1;
- }
- return hares;
- }
- int count = Convert.ToInt32(Console.ReadLine());
- int[] print = new int[count];
- for (int i = 0; i < count; i++)
- {
- int n = Convert.ToInt32(Console.ReadLine());
- print[i] = math(n);
- }
- for (int i = 0; i < count;i++)
- {
- Console.WriteLine(print[i]);
- }
- Console.ReadKey();
- }
- }
- }
Add Comment
Please, Sign In to add comment