fork download
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int main()
  5. {
  6. long long int t;
  7. float ans=0;
  8. cin>>t;
  9. while(t>0)
  10. {
  11. long long int x,y,a,b,i=1;
  12. cin>>x>>y>>a>>b;
  13.  
  14. if( ( (y-x)%(a+b) ) == 0)
  15. cout<<(y-x)/(a+b)<<"\n";
  16. else
  17. cout<<-1<<"\n";
  18. t--;
  19. }
  20. return 0;
  21. }
  22.  
Success #stdin #stdout 0s 4544KB
stdin
Standard input is empty
stdout
-1