When submitting a solution in C++, please select either C++14 (GCC 6-32) or C++17 (GCC 7-32) as your compiler. ×

sahil832's blog

By sahil832, history, 2 years ago, In English

https://codeforces.com/contest/1629/problem/B

can anyone pls explain what mistake I am making.

int l=nextInt();
  int r=nextInt();
  int k=nextInt();
  int x=r-l+1;
  if(l==r&&l==1){
    out.println("no");
    continue;
  }
  if(l==r&&l!=1){
    out.println("yes");
    continue;
  }
  if(x%2==0||l%2==0){
    x=x/2;
  }
  if(x%2==1&&l%2==1){
    x=(x/2)+1;
  }
  if(k>=x){
    out.println("yes");
  }
  else{
    out.println("no");
  }
  • Vote: I like it
  • -6
  • Vote: I do not like it