An Ordinary Game


Time limit : 2sec / Memory limit : 256MB

Score : 500 points

Problem Statement

There is a string s of length 3 or greater. No two neighboring characters in s are equal.

Takahashi and Aoki will play a game against each other. The two players alternately performs the following operation, Takahashi going first:

  • Remove one of the characters in s, excluding both ends. However, a character cannot be removed if removal of the character would result in two neighboring equal characters in s.

The player who becomes unable to perform the operation, loses the game. Determine which player will win when the two play optimally.

Constraints

  • 3≤|s|≤105
  • s consists of lowercase English letters.
  • No two neighboring characters in s are equal.

Input

The input is given from Standard Input in the following format:

s

Output

If Takahashi will win, print First. If Aoki will win, print Second.


Sample Input 1

Copy
aba

Sample Output 1

Copy
Second

Takahashi, who goes first, cannot perform the operation, since removal of the b, which is the only character not at either ends of s, would result in s becoming aa, with two as neighboring.


Sample Input 2

Copy
abc

Sample Output 2

Copy
First

When Takahashi removes b from s, it becomes ac. Then, Aoki cannot perform the operation, since there is no character in s, excluding both ends.


Sample Input 3

Copy
abcab

Sample Output 3

Copy
First

//有一个字符串,相邻的不能相同,两个人玩,一人每次可以删除除了首尾的任意一个,但是要保证删完不能相邻的相同,谁删到不能删就谁输,
给一个字符串,问谁赢
 #include <stdio.h>
#include <string.h> char str[];
int main()
{
while (scanf("%s",str)!=EOF)
{
int len=strlen(str);
int res;
if (str[]==str[len-])
res=len-;
else
res=len-;
if (res%==)
printf("First\n");
else printf("Second\n");
}
return ;
}

An Ordinary Game(简单推导)的更多相关文章

  1. 贝塞尔曲线.简单推导与用opengl实现动态画出。

    在opengl中,我们可以用少许的参数来描述一个曲线,其中贝塞尔曲线算是一种很常见的曲线控制方法,我们先来看维基百科里对贝塞尔曲线的说明: 线性贝塞尔曲线 给定点P0.P1,线性贝塞尔曲线只是一条两点 ...

  2. Python学习3——Python的简单推导

    列表推导是一种从其他列表创建列表的方式,类似于数学中的集合推导,列表推导的工作原理非常简单,类似于for循环.(以下代码均在IDLE实现) 最简单的列表推导: >>>[x*x for ...

  3. HIT手 | 机械电气构造简述和微分运动学及静力学的简单推导

      机械结构电气构造简述 HIT手有四个手指,每个手指4个关节,其中第一和第二个关节正交,第三和第四个关节机械耦合,故只有3个自由度,另外大拇指多了一个相对手掌运动的自由度,故一只手掌总共有13各个自 ...

  4. Codeforces Round #554 (Div. 2) C. Neko does Maths (简单推导)

    题目:http://codeforces.com/contest/1152/problem/C 题意:给你a,b, 你可以找任意一个k     算出a+k,b+k的最小公倍数,让最小公倍数尽量小,求出 ...

  5. Logistic Regression 的简单推导

    Logistic Regression 是一种 Generalized Linear Model(GLM),也即广义线性模型. 1. LR 的基本假设 LR 模型假设观测值 y 成立的对数几率(log ...

  6. 简单推导 PCA

    考虑二维数据降低到一维的例子,如下图所示: 最小化投影方差(maximize projected variance): 1N∑n=1N(uuT1xn−uuT1x¯)=uuT1Suu1,s.t.uuT1 ...

  7. Pytorch Linear ()简单推导

    pytorch,nn.Linear 下图中的A是权重矩阵,b是偏置. in_features输入样本的张量大小 out_features输出样本的张量大小 bias是偏置 # 测试代码 # batch ...

  8. 【LOJ#3197】【eJOI2019】T形覆盖 - (图论、简单推导)

    题面 题解 (题目中说的四种摆放方式实际上是分别旋转0°,90°,180°,270°后的图形) 题目中关于摆放方式的描述听起来很臭,我们把它转换一下,每个拼版先覆盖"上下左右中"五 ...

  9. OpenGL中投影矩阵的推导

    本文主要是对红宝书(第八版)第五章中给出的透视投影矩阵和正交投影矩阵做一个简单推导.投影矩阵的目的是:原始点P(x,y,z)对应后投影点P'(x',y',z')满足x',y',z'∈[-1,1]. 一 ...

随机推荐

  1. linux 通过两个网卡,连接不同的不同的网段

    linux数据包转发功能 A:192.168.xxx.xxx   B:172.24.xxx.xxx, 从而实现了A网段和B网段的互通. 原因Linux机器可以通过设置实现数据包的转发功能. #echo ...

  2. http://jingyan.baidu.com/article/0eb457e5208cbb03f0a9054c.html

    http://jingyan.baidu.com/article/0eb457e5208cbb03f0a9054c.html

  3. 新人补钙系列教程之:拒绝CPU高占用

    1.关于MovieClip和Sprite的鼠标事件,当不需要鼠标事件的时候将mouseEnabled和mouseChildren设为false. 不断的检测鼠标交互事件会消耗CPU,尤其是大量交互对象 ...

  4. 遍历Enumeration

    版权声明:http://blog.csdn.net/qq924862077/ Enumeration(枚举)接口的作用和Iterator类似,只提供了遍历Vector和HashTable类型集合元素的 ...

  5. Redis源代码分析(十三)--- redis-benchmark性能測试

    今天讲的这个是用来给redis数据库做性能測试的,说到性能測试,感觉这必定是高大上的操作了.redis性能測试.測的究竟是哪方面的性能,怎样測试,通过什么指标反映此次測试的性能好坏呢.以下我通过源代码 ...

  6. Html5 Canvas之arc函数图示详解

    在不变换坐标系的情况下,arc函数画弧的方向如下图所示: 举例来说,arc(x,y,r,Math.PI/6,Math.PI/3,false);是以x,y为圆心,r为半径,从x正轴顺时针30度为起始角, ...

  7. ionic - 运行起来

    更新时间: 2018-8-1 (首次更新) 1.首先下载python(至于为什么安装,看截图) https://www.python.org/downloads/release/python-370/ ...

  8. Error: [mobx] Since strict-mode is enabled, changing observed observable values outside actions is not allowed. Please wrap the code in an `action` if this change is intended.

    1.Error: [mobx] Since strict-mode is enabled, changing observed observable values outside actions is ...

  9. 最新版的 react-native 降级处理

    1.react-native 常见操作 (1)react-native init Demo (2)adb devices (3)react-native run-android (4)ipconfig ...

  10. v-if 条件渲染分组

    因为 v-if 是一个指令,所以必须将它添加到一个元素上.但是如果想切换多个元素呢?此时可以把一个 <template> 元素当做不可见的包裹元素,并在上面使用 v-if.最终的渲染结果将 ...