problem link : MINI2 Problem - CodeChef
my solution :
#include <bits/stdc++.h>
using namespace std;
#define int long long
int32_t main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int t;
cin>>t;
while(t--)
{
int n;
cin>>n;
int a=sqrt(n);
if(n%a==0)
{
cout<<2*a<<endl;
}
else
{
for(int i=a;i<=n;i++)
{
a=a+1;
if(n%a==0)
{
cout<<(a+(n/a))<<endl;
break;
}
else
{
continue;
}
}
}
}
return 0;
}
please help me out the test case is running fine , I can’t find any fault