sivan_iut

Untitled

Feb 16th, 2020
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.37 KB | None | 0 0
  1. #include<stdio.h>
  2. int main()
  3. {
  4.     int T;
  5.     scanf("%d",&T);
  6.     int i;
  7.     int count=0;
  8.     long long x,y,a,b;
  9.     for(i=0;i<T;i++)
  10.     {
  11.         scanf("%lld%lld%lld%lld",&x,&y,&a,&b);
  12.     }
  13.     while(x<y)
  14.   {
  15.  
  16.     x=x+a;
  17.     y=y-b;
  18.     count++;
  19.     if(x-y==0)
  20.   printf("%d",count);
  21.     else if(x-y!=0)
  22.             printf("-1");
  23.  
  24. }
  25.  
  26.     return 0;
  27. }
Add Comment
Please, Sign In to add comment