poj 2664 Prerequisites?

//给出选择的科目和分类,看选课是否达标! 
#include <iostream>
#include <string>
using namespace std;

int course[110];
bool flag[110];

int main()
{
    int k, m, c, r, i, j, l, tmp, ct;
    bool ff;
    while (cin >> k){
          if (k == 0)  break;
          cin >> m;
          memset(flag, false, sizeof(flag));
          ff = false;
          for (i = 0; i < k; i++)
              cin >> course[i];
          for (i = 0; i < m; i++){
              cin >> c >> r;
              ct = 0;
              for (j = 0; j < c; j++){
                  cin >> tmp;
                  for (l = 0; l < k; l++){
                      if (tmp == course[l])
                         ct++;
                  }
              }
              if (ct >= r)
                 flag[i] = true;
          }
          for (i = 0; i < m; i++)
              if (flag[i] == false){
                  ff = true;
                  break;
              }
          if (ff)
             cout << "no" << endl;
          else
             cout << "yes" << endl;
    }
    
    system("pause");
}

你可能感兴趣的:(poj 2664 Prerequisites?)