Author: Ismail Hosen
Daffodil International University
Problem Link
//Please follow from main function
#include<bits/stdc++.h>
using namespace std;
long long int ans=1e18, n, f, k, i;
int main()
{
cin>>n>>k;
for(i=1;i<k;i++)
{
if(n%i!=0)continue;
f=n/i;
ans=min(ans,k*f+i);
}
cout<<ans<<endl;
return 0;
}
0 Comments