You are viewing a single comment's thread. Return to all comments →
Yes there are a number of conditions to check:
int num = x2 - x1; int den = v1 - v2; if (den == 0) cout << "NO"; else if (num % den != 0) cout << "NO"; else if (num > 0 && den < 0) cout << "NO"; else cout << "YES";
If x1 < x2 would not be stated, there are just two more conditions to check:
if (num == 0) cout << "YES"; else if (den == 0) cout << "NO"; else if (num % den != 0) cout << "NO"; else if (num < 0 && den > 0) cout << "NO"; else if (num > 0 && den < 0) cout << "NO"; else cout << "YES";
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 →
Yes there are a number of conditions to check:
If x1 < x2 would not be stated, there are just two more conditions to check: