//这题属于简单题,只要你有耐心读懂题目就很简单了!
#include "iostream"
#include "string"
#include "memory.h"
using namespace std;
string chosencourses[110];//已选课程
string categorycourses[110];//分类中的课程
bool flag[110];
int main()
{
int k, m, c, r, i, j, q, count;
while (cin >> k && k)
{
cin >> m;
memset(flag, false, sizeof(flag));
for (i = 0; i < k; i++)
cin >> chosencourses[i];
for (i = 0; i < m; i++)
{
cin >> c >> r;
count = 0;
for (j = 0; j < c; j++)
{
cin >> categorycourses[j];
for (q = 0; q < k; q++)
{
if (categorycourses[j] == chosencourses[q])
count++;
}
if (count >= r)
flag[i] = true;
}
}
for (j = 0; j < m; j++)
{
if (flag[j] == false)
{
cout << "no" << endl;
break;
}
}
if (j == m)
cout << "yes" << endl;
}
}
zoj 2548 Prerequisites?
最新推荐文章于 2022-02-25 21:57:21 发布