Open utterances-bot opened 2 years ago
https://oj.luyencode.net/problem/KANGAROO
Đây là lời giải của mình đã AC. Nếu bạn đã cố gắng mà chưa làm được thì có thể tham khảo lời giải của mình.
#include using namespace std; int main(){ ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); int t; cin >> t; while(t--){ int a, b, c, d; cin >> a >> b >> c >> d; int cnt = 0, sum1 = a, sum2 = c; for(int i=0;i<=10000;i++){ sum1+=b; sum2+=d; if(sum1==sum2){ cnt++; break; } } if(cnt==0) cout << "NO"; else cout << "YES"; cout << "\n"; } }
Bước nhảy KANGAROO - Luyện Code Online
https://oj.luyencode.net/problem/KANGAROO