hdu 2537
地址:http://acm.hdu.edu.cn/showproblem.php?pid=2537
题意:打台球,一人一次机会(明显不符合实际。。。)
mark:扫描一遍~
代码:
#include <stdio.h> int main() { int t,i,r,y,f; char a[20]; while(scanf("%d", &t), t) { scanf("%s", a); r = y = 7; for(i = f = 0; a[i]; i++) { if(a[i] == 'R') r--; else if(a[i] == 'Y') y--; else if(a[i] == 'B') f = r ? 0 : 1; else f = y ? 1 : 0; } puts(f ? "Red" : "Yellow"); } return 0; }
ps:本人第一篇博客,虽然是水题,但是还是走出了第一步~嘿嘿~