标签:水题
3 basketball fork chopsticks 2 bowl letter
fork chopsticks bowl
南阳OJ上的说是贪心,我也是醉了,太水了,不考虑最后元素的空格竟然也能过,我。。。。。。
代码如下:
#include<stdio.h> #include<string.h> char a[110][110]; int main() { int n,i; while(~scanf("%d",&n)) { for(i=0;i<n;i++) { scanf("%s",a[i]); } for(i=0;i<n;i++) { if(strcmp(a[i],"bowl")==0) printf("bowl "); if(strcmp(a[i],"knife")==0) printf("knife "); if(strcmp(a[i],"fork")==0) printf("fork "); if(strcmp(a[i],"chopsticks")==0) printf("chopsticks "); } printf("\n"); } return 0; }
标签:水题
原文地址:http://blog.csdn.net/ice_alone/article/details/41444533