3EBD5EF's blog

By 3EBD5EF, history, 15 months ago, In English

``````https://codeforces.com/edu/course/2/lesson/6/2/practice/contest/283932/problem/C

In this problem i got wrong in test case 5

can anyone please help me to find the problem.

Thanks in advance ~~~~~ #include<bits/stdc++.h> using namespace std; #define long long long

long n,x,y;

bool good(long m) {
return ((m/x)+(m/y))>=(n-1); }

int main() { ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);

cin>>n>>x>>y;

long a=min(x,y);

long l=0;
long r=n*min(x,y);
while(r>l+1)
{
    long mid =(l+r)>>1;
    if(good(mid)) r=mid;
    else  l=mid;
}
cout<<r+a<<endl;

} ~~~~~

Full text and comments »

  • Vote: I like it
  • -6
  • Vote: I do not like it