Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- constexpr int NMAX = 1e3 + 3;
- bitset<NMAX> canArriveAt;
- signed main() {
- int x, y, z;
- cin >> x >> y >> z;
- canArriveAt[0] = true;
- for (int i = 0; i <= z; i++) {
- if (canArriveAt[i]) {
- canArriveAt[i + x] = true;
- canArriveAt[i + y] = true;
- }
- }
- if (canArriveAt[z]) {
- puts("DA");
- } else {
- puts("NU");
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement