Help me in solving LBC17 problem

My issue

My code

// Update the code below to solve this problem

#include <iostream>
#include <string>
using namespace std;

int main() 
{
  int t;
  cin>>t; 
  while(t--)
  {
  int X, Y,n;
  static int i=0;
  cin>>X>>Y;
  if((10*(i-1)+1<=X<=10*i)&&(10*(i-1)+1<=Y<=10*i)){
     cout<<0<<endl;
  }
  for(int i=0;i<=10*(i-1)+1;i++){
  if((10*(i-n-1)+1<=X<=10*(i-1))&&(10*(i-1)+1<=Y<=10*i)){
      cout<<i-(i-n-1)<<endl;
  }
  }
  
   }
return 0;
}

Learning course: Solve Programming problems using C++
Problem Link: CodeChef: Practical coding for everyone

@ai211003
i don’t get the logic
from my side its quite simple just print the absolute difference between the ceiling division of X and Y by 10;

1 Like