#include <algorithm>
#include <iostream>
#include <cstring>
#include <cstdio>

using std::cout;
using std::sort;
using std::endl;
bool dp[1000010];
int n,m;
int move[11];
int main()
{
    while(scanf("%d%d",&n,&m)==2)
    {
        for(int i=0; i<m; i++)
        scanf("%d",&move[i]);
        dp[0]=false;
        for(int i=1; i<=n; i++)
        {
            dp[i]=false;
            for(int j=0; j<m; j++)
            {
                if(i>=move[j] && !dp[i-move[j]])
                {
                    dp[i]=true;
                    break;
                }
            }
        }
        if(dp[n])
            puts("Stan wins");
        else puts("Ollie wins");
    }
    return 0;
}
View Code

 

posted on 2013-09-05 16:48  风流monkey  阅读(113)  评论(0编辑  收藏  举报