Source Code
#include <bits/stdc++.h>
using namespace std;

int main(){
	int n,x,y;
	cin>>n>>x>>y;
	long long ans = 1e10;
	long long high = n, low = 0;
	while(high>=low){
		long long mid = (high+low)/2;

		long long time = max(mid*x , (n-mid)*y);
		// cout<<mid<<" ----> "<<time<<endl;
		if(time < ans){
			low = mid+1;
			ans = time;
		}
		else
			high = mid-1;
	}
	cout<<ans;
}
Copy
Hurry up hashemtb
GNU G++17
1 ms
256 KB
Wrong Answer