UVA 10919
题目介绍:
Freddie the frosh has
chosen to take k courses.
To meet the degree requirements, he must
take courses from each
of several categories.
Can you assure Freddie that he will graduate, based on his
course selection?
大意:
简单的判断学的课程够没够,用set即可
AC代码:
#include<iostream>
#include<cstring>
#include<set>
using namespace std;
int main(){
int n,k;
while(scanf("%d",&n)&&n){
scanf("%d",&k);
set<string> study;
for(int i=0;i<n;i++){
string s;
cin>>s;
study.insert(s);
}
int ok=0;
for(int i=0;i<k;i++){
int r,c;
scanf("%d%d",&r,&c);
int num=0;
for(int j=0;j<r;j++){
string s;
cin>>s;
if(study.count(s))num++;
}
if(num<c)ok=1;
}
printf("%s\n", ok==0 ? "yes" : "no");
}
return 0;
}