http://acm.hdu.edu.cn/showproblem.php?pid=2537

模拟

View Code
#include <stdio.h>
char a[100];
int n;
int gao()
{
    int r,y,i;
    r=y=7;
    for(i=0;i<n;i++)
    {
        if(a[i]=='R')r--;
        if(a[i]=='Y')y--;
        if(a[i]=='B'&&r==0)return 1;
        if(a[i]=='B'&&r!=0)return 0;
        if(a[i]=='L'&&y==0)return 0;
        if(a[i]=='L'&&y!=0)return 1;
    }
}
int main()
{
    while(scanf("%d%*c",&n),n)
    {
        gets(a);
        puts(gao()?"Red":"Yellow");
    }
    return 0;
}

 

相关文章:

  • 2021-08-13
  • 2021-09-19
  • 2021-09-09
  • 2021-12-28
  • 2021-06-11
  • 2021-04-24
  • 2021-10-14
猜你喜欢
  • 2021-08-17
  • 2022-03-04
  • 2021-11-30
  • 2021-12-09
  • 2022-02-22
  • 2021-05-16
相关资源
相似解决方案