Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Kangaroo
- #include <iostream>
- using namespace std;
- int main()
- {
- int x1, x2, v1, v2, ats=0;
- cin >> x1 >> v1 >> x2 >> v2;
- if(x1>x2)
- {
- while(x1>=x2)
- {
- if(x1==x2)
- {
- ats=1;
- }
- x1=x1+v1;
- x2=x2+v2;
- }
- }
- else if(x2>=x1)
- {
- while(x2>=x1)
- {
- if(x1==x2)
- {
- ats=1;
- }
- x1=x1+v1;
- x2=x2+v2;
- }
- }
- if(ats==0){cout<<"NO"<<endl;}else{cout<<"YES"<<endl;}
- return 0;
- }
Add Comment
Please, Sign In to add comment