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; }