Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- using namespace std;
- #define faster ios_base::sync_with_stdio(0)
- int main()
- {
- faster;
- int t;
- cin>>t;
- while(t--)
- {
- long long int g,l,r;
- cin>>l>>r>>g;
- long long int a,b;
- a=ceil(1.0*l/g);
- b=floor(1.0*r/g);
- if((b-a+1)==1){
- if(l>g)cout<<0<<endl;
- else cout<<1<<endl;
- }
- else cout<<b-a+1<<endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement