You are viewing a single comment's thread. Return to all comments →
// C++ basic code.
using namespace std;
// void sol(int sum1,int b,int c,int d,int e){
// } int main(){ int x1,v1,x2,v2; cin>>x1>>v1>>x2>>v2; int sum1=x1,sum2=x2,i=0; if(x2>x1&&v2>v1){ cout<<"NO"; return 0; }
while(sum1!=sum2){ sum1=sum1+v1; sum2=sum2+v2; if(sum1==sum2){ i++; cout<<"YES"; break; } if(v2>v1&&sum2>sum1||sum1>sum2&&v1>v2){ i++; cout<<"NO"; break; } } if(i==0){ cout<<"NO"; } return 0;
}
Seems like cookies are disabled on this browser, please enable them to open this website
Number Line Jumps
You are viewing a single comment's thread. Return to all comments →
// C++ basic code.
include
include
using namespace std;
// void sol(int sum1,int b,int c,int d,int e){
// } int main(){ int x1,v1,x2,v2; cin>>x1>>v1>>x2>>v2; int sum1=x1,sum2=x2,i=0; if(x2>x1&&v2>v1){ cout<<"NO"; return 0; }
}