fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. typedef long long ll;
  4. const int Mod=998244353;
  5.  
  6. void solve() {
  7. int l,r;
  8. cin >> l >> r;
  9. int ans = 0 ;
  10. for(int i=l;i<=r;i++) if(i%2==1) ans++;
  11. cout << ans/2 << '\n';
  12. }
  13.  
  14. int main(){
  15. ios::sync_with_stdio(false);
  16. cin.tie(nullptr);
  17.  
  18. int t;
  19. cin >> t;
  20. while (t--) solve();
  21.  
  22.  
  23. return 0;
  24. }
  25.  
Success #stdin #stdout 0s 5324KB
stdin
8
1 3
3 7
10 21
2 8
51 60
2 15
10 26
1 1000
stdout
1
1
3
1
2
3
4
250