Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <cstdio>
- #include <iostream>
- #include <algorithm>
- using namespace std;
- int a[105], n;
- bool ans(int pos) {
- if (pos > n)
- return true;
- if (a[pos] == 1)
- return (!ans(pos + 1));
- return true;
- }
- int main() {
- freopen("smallnim.in", "r", stdin);
- freopen("smallnim.out", "w", stdout);
- cin >> n;
- for (int i = 0; i < n; i++)
- cin >> a[i];
- sort(a, a + n);
- if (ans(0))
- cout << "YES\n" << (a[0] - 1 > 0 ? a[0] - 1: 1);
- else
- cout << "NO\n";
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement