~cpp #include <iostream> #include <cmath> using namespace std; int testcase, x, y, sqrtNum, powNum; int showResult(int number) { sqrtNum = floor(sqrt(number-1)); powNum = sqrtNum * sqrtNum; if(number==0) return 0; else if(number>powNum && number<=(powNum+sqrtNum)) return 2*sqrtNum; else return 2*sqrtNum+1; } int main() { cin >> testcase; while(testcase--) { cin>>x>>y; cout << showResult(y-x) << endl; } return 0; }