3 basketball fork chopsticks 2 bowl letter
fork chopsticks bowl
The tableware only contains: bowl, knife, fork and chopsticks.
辽宁省赛2010
#include <algorithm> #include <iostream> #include <cstring> #include <cstdlib> #include <cstdio> #include <string> #include <vector> #include <cmath> #include <ctime> #include <queue> #include <stack> #include <set> #include <map> using namespace std; typedef long long LL; const int maxn= 100000 + 10; char str[maxn]; char ss[4][20]= {"bowl","knife","fork","chopsticks"}; int main() { int n; while(~scanf("%d",&n)) { bool flag=0; for(int i=0; i<n; i++) { scanf("%s",str); for(int j=0; j<4; j++) if(strcmp(str,ss[j])==0) { if(flag) printf(" %s",ss[j]); else { printf("%s",ss[j]);flag=1; } break; } } puts(""); } return 0; }
原文:http://www.cnblogs.com/zsychanpin/p/6939694.html