You are viewing a single comment's thread. Return to all comments →
c++ use while
string kangaroo(int x1, int v1, int x2, int v2) { cin >> x1 >> v1 >> x2 >> v2; int sum1 = x1, sum2 = x2; while(sum1<sum2){ if(sum1 != sum2){ sum1 += v1; sum2 += v2; } } if(sum1!=sum2) return "NO"; else return "YES";
}
Number Line Jumps
You are viewing a single comment's thread. Return to all comments →
c++ use while
}