[CF1220C]

Description

给定一个字符串 \(S\) , 同时维护一个区间 \([l,r]\) 。轮流操作,每次可以扩展到一个新区间使得原区间是新区间的真子区间,并且字典序更小,不能操作的人输。初态区间为 \([k,k]\) ,你需要对 \(k=1,2,...,|S|\) 判断胜负性。

Solution

很容易发现游戏最多玩一轮,所以只需要判断每个字母之前有没有更小的字母就可以了。

#include <bits/stdc++.h>
using namespace std;

string str;
int c[27];

int main()
{
    ios::sync_with_stdio(false);
    cin>>str;
    int n=str.length();
    for(int i=0;i<n;i++)
    {
        c[str[i]-'a'+1]++;
        int flag=0;
        for(int j=0;j<str[i]-'a'+1;j++) flag+=c[j];
        if(flag) cout<<"Ann"<<endl;
        else cout<<"Mike"<<endl;
    }
}

相关文章:

  • 2021-08-26
  • 2021-07-04
  • 2022-03-07
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2018-02-18
猜你喜欢
  • 2022-12-23
  • 2021-06-27
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-05-03
  • 2021-08-14
相关资源
相似解决方案