An Ordinary Game(简单推导)
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
aba
Sample Output 1
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
abc
Sample Output 2
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
abcab
Sample Output 3
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(简单推导)的更多相关文章
- 贝塞尔曲线.简单推导与用opengl实现动态画出。
		
在opengl中,我们可以用少许的参数来描述一个曲线,其中贝塞尔曲线算是一种很常见的曲线控制方法,我们先来看维基百科里对贝塞尔曲线的说明: 线性贝塞尔曲线 给定点P0.P1,线性贝塞尔曲线只是一条两点 ...
 - Python学习3——Python的简单推导
		
列表推导是一种从其他列表创建列表的方式,类似于数学中的集合推导,列表推导的工作原理非常简单,类似于for循环.(以下代码均在IDLE实现) 最简单的列表推导: >>>[x*x for ...
 - HIT手 | 机械电气构造简述和微分运动学及静力学的简单推导
		
机械结构电气构造简述 HIT手有四个手指,每个手指4个关节,其中第一和第二个关节正交,第三和第四个关节机械耦合,故只有3个自由度,另外大拇指多了一个相对手掌运动的自由度,故一只手掌总共有13各个自 ...
 - Codeforces Round #554 (Div. 2)   C. Neko does Maths  (简单推导)
		
题目:http://codeforces.com/contest/1152/problem/C 题意:给你a,b, 你可以找任意一个k 算出a+k,b+k的最小公倍数,让最小公倍数尽量小,求出 ...
 - Logistic Regression 的简单推导
		
Logistic Regression 是一种 Generalized Linear Model(GLM),也即广义线性模型. 1. LR 的基本假设 LR 模型假设观测值 y 成立的对数几率(log ...
 - 简单推导 PCA
		
考虑二维数据降低到一维的例子,如下图所示: 最小化投影方差(maximize projected variance): 1N∑n=1N(uuT1xn−uuT1x¯)=uuT1Suu1,s.t.uuT1 ...
 - Pytorch Linear ()简单推导
		
pytorch,nn.Linear 下图中的A是权重矩阵,b是偏置. in_features输入样本的张量大小 out_features输出样本的张量大小 bias是偏置 # 测试代码 # batch ...
 - 【LOJ#3197】【eJOI2019】T形覆盖 - (图论、简单推导)
		
题面 题解 (题目中说的四种摆放方式实际上是分别旋转0°,90°,180°,270°后的图形) 题目中关于摆放方式的描述听起来很臭,我们把它转换一下,每个拼版先覆盖"上下左右中"五 ...
 - OpenGL中投影矩阵的推导
		
本文主要是对红宝书(第八版)第五章中给出的透视投影矩阵和正交投影矩阵做一个简单推导.投影矩阵的目的是:原始点P(x,y,z)对应后投影点P'(x',y',z')满足x',y',z'∈[-1,1]. 一 ...
 
随机推荐
- 重新认识被人遗忘的HTTP头注入
			
前言 注入类漏洞经久不衰,多年保持在owasp Top 10的首位.今天就聊聊那些被人遗忘的http头注入.用简单的实际代码进行演示,让每个人更深刻的去认识该漏洞. HOST注入 在以往http1.0 ...
 - Scala和Java二种方式实战Spark Streaming开发
			
一.Java方式开发 1.开发前准备:假定您以搭建好了Spark集群. 2.开发环境采用eclipse maven工程,需要添加Spark Streaming依赖. 3.Spark streaming ...
 - java根据身份证号和获取用户年龄和性别的工具类
			
import java.text.SimpleDateFormat; import java.util.Date; import java.util.HashMap; import java.util ...
 - 使用theHarvester 进行邮箱和子域名的收集
			
下载地址:https://github.com/laramies/theHarvester 先要安装python的 reqeusts 库 安装pip install reqeustsmail -d b ...
 - Linux 常见安全检查方法
			
Linux 常见安全检查方法进行概要说明: 一.检查系统密码文件,查看文件修改日期 # ls -l /etc/passwd 二.查看 passwd 文件中有哪些特权用户 # awk -F: '$3= ...
 - ejs - 初试
			
官方API: https://www.npmjs.com/package/ejs - 模板引擎 ejs文件(和普通html文件没什么区别,只是多增加了变量) <!DOCTYPE html> ...
 - NYOJ 257 郁闷的C小加(一)
			
郁闷的C小加(一) 时间限制:1000 ms | 内存限制:65535 KB 难度: 描写叙述 我们熟悉的表达式如a+b.a+b*(c+d)等都属于中缀表达式.中缀表达式就是(对于双目运算符来说) ...
 - 升级滑动销毁activity,随着手势的滑动而滑动的效果
			
文章开头先注明本滑动销毁是对 http://blog.csdn.net/xiaanming/article/details/20934541 这篇博客的内容进行一个小小的改动 添加向左滑动打开另外一个 ...
 - 分组password算法
			
代换,S盒.扩散和混淆,这些概念构成了分组password学的基础. 假设明文和密文的分组长度都为n比特,则明文的每个分组都有2n个可能的取值; 代换: 为使加密运算可逆(即解密运算可行),明文的每个 ...
 - Maven - error in opening zip file
			
在一个maven工程中,有时执行mvn打包,部署,编译等命令,例如mvn clean install -DskipTests -U等命令时,会报类似(error in opening zip file ...