 # MATHEXM EDITORIAL

PROBLEM LINK
Chefu And Math Exam

Editorialist:-Faiz Alam
Author and Tester:-Prasoon Jain

PREREQUISITES
Maths,Observation

PROBLEM
Given a positive integer A ,find two integers B and C , and return the minimum sum B+C
provided B*C>A and B and C need not to be dinstinct.

EXPLANATION
Since we have to find two integers whose product is exclusively greater than A and also the sum of these two needs to be minimum ,this is possible if we take the square root of A and the apply the condition B*C >A to find wheater B and C both would be same and each equal to sqrt(A)+1 or one of them would be sqrt(A) and other would be sqrt(A)+1.

SOLUTIONS

Editorialist's Solution
``````   #include<bits/stdc++.h>
#define ll long long int
using namespace std;

int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
ll t;
cin>>t;
while(t--)
{
ll a;
cin>>a;
ll res=sqrt(a);
if((res*(res+1))>a)
{
cout<<2*res+1<<"\n";
}
else
{
cout<<2*res+2<<"\n";
}
}
return 0;}
``````

Complexity:-O(1)

1 Like