题目链接:http://codeforces.com/contest/1104/problem/B

       题意是给了一个字符串,有两个人轮流操作,每个人删除任意位置两个相同的相邻的字符,删除后剩下的字符串再拼起来,直到不能再操作了为止,如果是第二个人不能再操作了就输出Yes,否则就是No。

       不是很难,一读懂题就想到了括号配对,所以就有了历史最快的过题记录!(差点拿一血)


AC代码:

#include <bits/stdc++.h>
using namespace std;
int pre[100005];

int main()
{
  string str;
  cin>>str;
  int len = str.length();
  stack<char> s;
  int ans = 0;
  for(int i=0;i<len;i++){
    if(s.size() == 0){s.push(str[i]);continue;}
    if(s.top() == str[i]){
      s.pop();
      ans++;
    }
    else{
      s.push(str[i]);
    }
  }
  if(ans % 2 == 1)puts("Yes");
  else puts("No");
  return 0;
}