cdoj 24 8球胜负(eight) 水题
8球胜负(eight)
Time Limit: 20 Sec Memory Limit: 256 MB
题目连接
http://acm.uestc.edu.cn/#/problem/show/24
Description
8球是一种台球竞赛的规则。台面上有7个红球、7个黄球以及一个黑球,当然还有一个白球。对于本题,我们使用如下的简化规则:红、黄两名选手轮流用白球击打各自颜色的球,如果将该颜色的7个球全部打进,则这名选手可以打黑球,如果打进则算他胜。如果在打进自己颜色的所有球之前就把黑球打进,则算输。如果选手不慎打进了对手的球,入球依然有效。
现在给出打进的球(白球除外)的顺序,以及黑球由哪方打进,你的任务是判定哪方是胜者。
假设不会有一杆同时打进一颗黑球和其他彩球。
Input
输入包含多组数据。每组数据第一行是一个整数N(1≤N≤15),表示打进的球的个数,N=0表示结束。随后有一行,包含N个字符,依序表示打进的是何种球。如果是B,表示是红方打进的黑球,如果是L,表示是黄方打进的黑球。如果是Y则表示是黄球,R表示红球。字符间没有空格。
所有输入都满足如下条件:最后一颗球打进时这局比赛正好结束,而且打进的红球和黑球都不超过7个。
Output
对每组数据,输出一行。如果红方胜,输出Red;黄方胜,输出Yellow。
Sample Input
5
RYRRB
9
RRRRYRRRB
Sample Output
Yellow
Red
HINT
题意
题解:
水题
代码:
//qscqesze
#include <cstdio>
#include <cmath>
#include <cstring>
#include <ctime>
#include <iostream>
#include <algorithm>
#include <set>
#include <vector>
#include <sstream>
#include <queue>
#include <typeinfo>
#include <fstream>
#include <map>
#include <stack>
typedef long long ll;
using namespace std;
//freopen("D.in","r",stdin);
//freopen("D.out","w",stdout);
#define sspeed ios_base::sync_with_stdio(0);cin.tie(0)
#define test freopen("test.txt","r",stdin)
#define maxn 200000
#define mod 10007
#define eps 1e-9
int Num;
char CH[];
const int inf=0x3f3f3f3f;
const ll infll = 0x3f3f3f3f3f3f3f3fLL;
inline ll read()
{
ll x=,f=;char ch=getchar();
while(ch<''||ch>''){if(ch=='-')f=-;ch=getchar();}
while(ch>=''&&ch<=''){x=x*+ch-'';ch=getchar();}
return x*f;
}
inline void P(int x)
{
Num=;if(!x){putchar('');puts("");return;}
while(x>)CH[++Num]=x%,x/=;
while(Num)putchar(CH[Num--]+);
puts("");
}
//************************************************************************************** int n;
int flag;
char s[maxn];
int main()
{
//test;
while(cin>>n)
{
if(n==)
break;
flag=;
int flag1=;
int flag2=;
scanf("%s",s+);
for(int i=;i<=n;i++)
{
if(s[i]=='Y')
flag2++;
else if(s[i]=='R')
flag1++;
else if(s[i]=='B')
{
if(flag1==)
flag=;
else
flag=;
}
else
{
if(flag2==)
flag=;
else
flag=;
}
}
if(flag==)
cout<<"Red"<<endl;
else
cout<<"Yellow"<<endl;
}
}
cdoj 24 8球胜负(eight) 水题的更多相关文章
- cdoj 71 I am Lord Voldemort 水题
I am Lord Voldemort Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.uestc.edu.cn/#/problem/ ...
- cdoj 03 BiliBili, ACFun… And More! 水题
Article Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.uestc.edu.cn/#/problem/show/3 Descr ...
- cdoj 26 遮挡判断(shadow) 水题
遮挡判断(shadow) Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.uestc.edu.cn/#/problem/show/26 ...
- hdu 1140:War on Weather(计算几何,水题)
War on Weather Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)To ...
- CDOJ_24 八球胜负
8球是一种台球竞赛的规则.台面上有7个红球.7个黄球以及一个黑球,当然还有一个白球.对于本题,我们使用如下的简化规则:红.黄两名选手轮 流用白球击打各自颜色的球,如果将该颜色的7个球全部打进,则这名选 ...
- [poj2247] Humble Numbers (DP水题)
DP 水题 Description A number whose only prime factors are 2,3,5 or 7 is called a humble number. The se ...
- CF451C Predict Outcome of the Game 水题
Codeforces Round #258 (Div. 2) Predict Outcome of the Game C. Predict Outcome of the Game time limit ...
- hdu 2041:超级楼梯(水题,递归)
超级楼梯 Time Limit: / MS (Java/Others) Memory Limit: / K (Java/Others) Total Submission(s): Accepted Su ...
- Educational Codeforces Round 7 B. The Time 水题
B. The Time 题目连接: http://www.codeforces.com/contest/622/problem/B Description You are given the curr ...
随机推荐
- propertyGrid控件 z
1.如果属性是enum类型,那么自然就是下拉的. 2.如果是你自定义的下拉数据,那么需要用到转换属性标签TypeConverter 参见: http://blog.csdn.net/luyifeini ...
- Dev gridControl z
Dev gridControl 添加表标题 1.OptionsView ->ShowViewCaption = True 2.ViewCaption = "标题" Dev g ...
- Bat 循環執行範例
@echo off @echo Please key in runcount num. Info:max=100 set /p a= for /l %%i in (1,1,%a%) do ( echo ...
- nginx upstream模块
upstream模块 upstream模块 (100%) nginx模块一般被分成三大类:handler.filter和upstream.前面的章节中,读者已经了解了handler.filter. 利 ...
- 自己使用python webob,paste.deploy,wsgi总结
paste.deploy就是一个可以配置wsgi_app的工具,可以让服务器运行时,按照配置文件执行一系列的程序.需要使用.ini配置文件. (1)这里补充一下当时没看到的配置文件 1.[app:ma ...
- no symbol version for module_layout
内核模块编译helloworld: no symbol version for module_layout, 尝试各种解决办法, 都没搞定, 版本也是对的. dmesg提示no symbol vers ...
- String内存陷阱简介
String 方法用于文本分析及大量字符串处理时会对内存性能造成一些影响.可能导致内存占用太大甚至OOM. 一.先介绍一下String对象的内存占用 一般而言,Java 对象在虚拟机的结构如下:•对象 ...
- Mapreduce执行过程分析(基于Hadoop2.4)——(二)
4.3 Map类 创建Map类和map函数,map函数是org.apache.hadoop.mapreduce.Mapper类中的定义的,当处理每一个键值对的时候,都要调用一次map方法,用户需要覆写 ...
- NovaMind *的安装、和谐破解到永久使用
XMind *思维导图的安装步 同类型的软件,这两款软件: XMind 和 NovaMind,各有所长.建议,都安装,合适的时候方便使用. XMind界面如下: NovaMind界面如下: 本博文,主 ...
- HD1085 Holding Bin-Laden Captive!
Problem Description We all know that Bin-Laden is a notorious terrorist, and he has disappeared for ...