Advertisement
Guest User

Untitled

a guest
May 20th, 2019
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. #define faster ios_base::sync_with_stdio(0)
  4.  
  5.  
  6. int main()
  7. {
  8. faster;
  9. int t;
  10. cin>>t;
  11. while(t--)
  12. {
  13. long long int g,l,r;
  14. cin>>l>>r>>g;
  15. long long int a,b;
  16. a=ceil(1.0*l/g);
  17. b=floor(1.0*r/g);
  18. if((b-a+1)==1){
  19. if(l>g)cout<<0<<endl;
  20. else cout<<1<<endl;
  21. }
  22. else cout<<b-a+1<<endl;
  23. }
  24.  
  25.  
  26. return 0;
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement