luyencode / comments

Server lưu trữ bình luận trên Luyện Code
https://luyencode.net
6 stars 3 forks source link

https://oj.luyencode.net/problem/KANGAROO #815

Open utterances-bot opened 2 years ago

utterances-bot commented 2 years ago

Bước nhảy KANGAROO - Luyện Code Online

https://oj.luyencode.net/problem/KANGAROO

danh2006 commented 2 years ago

Đâ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.

Xem code AC

#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"; } }