div2 620 A
A
Tag
数学,思维
设所需要的时间为 \(t\),两只兔子之间的距离为 \(c ur\)
\(cut = (y-bt) - (x+at)\)
\(t = (y-x)/(a+b)\)
#include <bits/stdc++.h>
using namespace std;
int main() {
int x,y,t,a,b,ans;
cin >> t;
while(t --) {
cin >> x >> y >> a >> b;
if((y - x) % (a + b) == 0) cout << (y - x) / (a + b) << endl;
else cout << "-1\n";
}
return 0;
}