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) 水题的更多相关文章

  1. cdoj 71 I am Lord Voldemort 水题

    I am Lord Voldemort Time Limit: 20 Sec  Memory Limit: 256 MB 题目连接 http://acm.uestc.edu.cn/#/problem/ ...

  2. cdoj 03 BiliBili, ACFun… And More! 水题

    Article Time Limit: 20 Sec  Memory Limit: 256 MB 题目连接 http://acm.uestc.edu.cn/#/problem/show/3 Descr ...

  3. cdoj 26 遮挡判断(shadow) 水题

    遮挡判断(shadow) Time Limit: 20 Sec  Memory Limit: 256 MB 题目连接 http://acm.uestc.edu.cn/#/problem/show/26 ...

  4. hdu 1140:War on Weather(计算几何,水题)

    War on Weather Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)To ...

  5. CDOJ_24 八球胜负

    8球是一种台球竞赛的规则.台面上有7个红球.7个黄球以及一个黑球,当然还有一个白球.对于本题,我们使用如下的简化规则:红.黄两名选手轮 流用白球击打各自颜色的球,如果将该颜色的7个球全部打进,则这名选 ...

  6. [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 ...

  7. CF451C Predict Outcome of the Game 水题

    Codeforces Round #258 (Div. 2) Predict Outcome of the Game C. Predict Outcome of the Game time limit ...

  8. hdu 2041:超级楼梯(水题,递归)

    超级楼梯 Time Limit: / MS (Java/Others) Memory Limit: / K (Java/Others) Total Submission(s): Accepted Su ...

  9. Educational Codeforces Round 7 B. The Time 水题

    B. The Time 题目连接: http://www.codeforces.com/contest/622/problem/B Description You are given the curr ...

随机推荐

  1. YII Framework学习教程-YII的安全

    web应用的安全问题是很重要的,在“黑客”盛行的年代,你的网站可能明天都遭受着攻击,为了从某种程度上防止被攻击,YII提供了防止攻击的几种解决方案.当然这里讲的安全是片面的,但是值得一看. 官方提供的 ...

  2. bzoj1013

    这道题题解太多,只贴代码. #include<cstdio> #include<cmath> #include<algorithm> using namespace ...

  3. 【LeetCode】202 - Happy Number

    Write an algorithm to determine if a number is "happy". A happy number is a number defined ...

  4. 【Android】创建、读取XML文件

    创建: package webdomain; import java.io.File; import java.io.FileNotFoundException; import java.io.Fil ...

  5. Git 常用操作。

    1.本地文件被修改后,却想要撤销所有的修改. SVN中可以简单地将被修改的文件直接删除,重新Update一下. Git中本以为可以将文件直接删除然后pull一下,然而却是不行的. 可以使用Revert ...

  6. 轻松学习Linux之AWK使用初步

    AWK最初是Unix平台上一种可以对文本进行逐行处理的编程语言,它来源于3个创作者的名字:Aho.(Peter)Weinberg和(Brain)Kernighan. 现在广泛应用于Linux,他与se ...

  7. ResultMap

    Mybatis 数据库字段和对象属性的映射 <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE ...

  8. c++builder 重载WindowProc、WndProc 截获消息

    c++builder 重载WindowProc.WndProc 截获消息 方法一WindowProc void __fastcall  myWindowProc(Messages::TMessage ...

  9. POJ 2826 An Easy Problem?!

    An Easy Problem?! Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 7837   Accepted: 1145 ...

  10. spring MVC 如何查找URL对应的处理类

    在spring 3.1之前,查找URL相应的处理方法,需要分两步,第一步是调用DefaultAnnotationHandlerMapping,查找到相应的controller类,第二步,再调用Anno ...