Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //N
- #include <bits/stdc++.h>
- using namespace std;
- bool win[100001][350];
- int main()
- {
- ios_base::sync_with_stdio(false);
- cin.tie(0);
- cout.tie(0);
- for (int i(1); i <= 100000; ++i)
- for (int k(1); k <= min(i, 349); ++k)
- if (i == k) win[i][k] = true;
- else win[i][k] = !win[i - k][k] || !win[i - k - 1][k + 1];
- int n; cin >> n; int test(0);
- //while (n)
- //{
- while (n)
- {
- cout << "Case #" << ++test << ": ";
- cout << (!win[n - 1][1] ? "First" : "Second");
- cout << " player wins.\n";
- cin >> n;
- }
- //}
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement