#include #include using namespace std; void prime(int n); bool dfs(int i, bool player); vector prime_num; bool first_win[10100][2] = {0}; int main() { int N; bool player = 1; cin >> N; cout << endl; prime(N); cout << (dfs(N, player) ? "win" : "Lose") << endl; return 0; } bool dfs(int i, bool player) { bool win; if(i==0 || i==1) return player; if(first_win[i][0]) return player != first_win[i][1]; if(player == 1){ win = 0; for(int j=0; i-prime_num[j]>=0; ++j){ if(dfs(i-prime_num[j], !player)){ win = 1; break; } } } else{ win = 1; for(int j=0; i-prime_num[j]>=0; ++j){ if(dfs(i-prime_num[j], !player) == 0){ win = 0; break; } } } first_win[i][0] = 1; first_win[i][1] = player != win; return(win); } void prime(int n) { bool is_prime[n+1]; for (int i=0; i