Minimum Class
Practice
3.8 (78 votes)
Ad Hoc
Mathematics
Open
Approved
Easy Medium
Mathamatics
Problem
28% Success 5609 Attempts 30 Points 1s Time Limit 256MB Memory 1024 KB Max Code

See Russian Translation

After a long term relationship, Anandi and Jagdish decided to marry. Anandi being a studious girl decided to complete her studies first. What next, she comes to ABC Public School. Her classes haven't even started yet and Jagdish becomes restless, comes to her college and asks her to complete her studies as soon as possible. Here comes the twist.

Anandi has to attend N classes in total. On the first day, she couldn't attend more than one class as she was too exhausted from the Semester Registration process. If Anandi takes x classes on some day, then she can take x, x-1 or x+1 classes on the next day. Jagdish on the other hand has asked Anandi to take no more than one class on the final day of her course so that she wouldn't be too tired for the marriage ceremony.

Help Anandi calculate the minimum number of days required to complete her course, keeping in mind the conditions mentioned above.

Input :

The first line contains an integer T denoting the number of test cases.

Each of the next T lines contain an integer N.

Output :

T lines : Minimum number of days required for each test case.

Constraints

1 <= N <= 10^9

1 <= T <= 1000

Please login to use the editor

You need to be logged in to access the code editor

Loading...

Please wait while we load the editor

Loading...
Results
Custom Input
Run your code to see the output
Submissions
Please login to view your submissions
Similar Problems
Points:30
3 votes
Tags:
MathematicsApprovedSimple-mathEasy-MediumMathematicsMathamatics
Points:30
500 votes
Tags:
MathematicsSieveEasy-MediumBinary search algorithmMathematicsMathamatics
Points:30
463 votes
Tags:
Ad-HocEasy-MediumMathamatics