zoukankan      html  css  js  c++  java
  • Round#534 div.2-B Game with string

    唔,第一次参加,掉了好多分。

    http://codeforces.com/contest/1104/problem/B

    不用考虑太多,string真的好厉害。

     1 #include<stdio.h>
     2 #include<string.h>
     3 #include<math.h>
     4 #include<iostream>
     5 #include<stdlib.h>
     6 #include<algorithm>
     7 #include<queue>
     8 #include<vector>
     9 #include<string>
    10 #include<set>
    11 #include<cctype>
    12 #include<sstream>
    13 #define mem(a) memset(a,0,sizeof(a))
    14 #define LL long long
    15 using namespace std;
    16 const int N=1e2+5;
    17 int a[N],n;
    18 string s;
    19 int main()
    20 {
    21   getline(cin,s);
    22   int sum=0;
    23   for(size_t i=0;i<s.size();i++)
    24   {
    25       while(s[i]==s[i+1]&&s.size())
    26             {
    27                 s.erase(i,2);
    28                 i--;
    29                 sum++;
    30             }
    31   }
    32   cout<<(sum%2?"Yes":"No");
    33     return 0;
    34 }
    View Code
  • 相关阅读:
    函数的内置方法
    函数
    文件操作
    三元运算
    流程控制
    集合
    div容器内文本对齐--神奇的css
    Struts2的零配置和rest插件
    MIME类型
    ganymed-ssh2使用
  • 原文地址:https://www.cnblogs.com/XXrll/p/10307272.html
Copyright © 2011-2022 走看看