Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- bool OkBits(int index, char c, bool isodd = 0){
- if((c == '0' || c == '3' || c == 'C' || c == 'F') || (isodd && (c == 'D' || c == 'E') || (isodd && index > 0 && (c == '1' || c == '2' ))))
- return 1;
- return 0;
- }
- int main()
- {
- int x, n;
- string t;
- cin >> x >> n >> t;
- bool ans = true;
- for (int i = 0, pos = 0; i < n; i += 2, pos++) {
- if (i == n - 1) {
- ans &= (OkBits(i, t[pos]) | OkBits(i, t[pos], 1));
- break;
- }
- if (!OkBits(i, t[pos])){
- ans = 0;
- break;
- }
- }
- if (ans)
- cout << "Nuslan is leaving us";
- else
- cout << "Nuslan stays";
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement