fork(1) download
  1. #include <iostream>
  2. using namespace std;
  3. int main() {
  4. long long x, y, testCase;
  5. cin >> testCase;
  6. for( long long k=0; k <testCase; k++){
  7. cin>> x >>y;
  8. long long dist = y-x;
  9. long long distCount = 1;
  10. long long maxCount=1;
  11. long long currentCount = 0;
  12.  
  13. for(long long j=1;j<dist;j++){
  14. currentCount++;
  15. if(currentCount==maxCount){
  16. currentCount=0;
  17. if(distCount%2==0){
  18. maxCount++;
  19. }
  20. distCount++;
  21. }
  22. }
  23.  
  24. cout<< distCount<<endl;
  25. }
  26. }
Success #stdin #stdout 1.18s 15232KB
stdin
1
1 2147483647
stdout
92681