Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- int main()
- {
- int t,j;
- long long int x, y, a, b,l,s1,s2,c=0 ;
- scanf("%d",&t);
- for(j=1; j<=t; j++)
- {
- scanf("%lld %lld %lld %lld",&x,&y,&a,&b);
- l=y-x;
- int i=0;
- while(l>c)
- {
- i++;
- s1=a*i;
- s2=b*i;
- c=s1+s2;
- }
- if(l==c)
- {
- printf("%d\n",i);
- }
- else printf("-1\n");
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement