fork(2) download
  1. #include<bits/stdc++.h>
  2. #define ll long long
  3. using namespace std;
  4. int main(){
  5. ios_base::sync_with_stdio(false);
  6. cin.tie(NULL);
  7. ll t;
  8. cin>>t;
  9. while(t--){
  10. ll n,m,k1,k2;
  11. vector<ll>v{0,0,1};
  12. cin>>n>>m;
  13. n--;
  14. if(m<=2)k1=v[m];
  15. else k1=floor(sqrt(m));
  16. if(n<=2)k2=v[n];
  17. else k2=floor(sqrt(n));
  18. cout<<k1-k2<<"\n";
  19.  
  20.  
  21. }}
Success #stdin #stdout 0s 4536KB
stdin
2
1 5
9 10
stdout
2
1