Prerequisites?

原文是English,这里直接就写中文吧

题意简述

k:已经选择的科目数;m:选择的科目类别;c:能够选择的科目数。r:要求最少选择的科目数量

在输入的k和m以下的一行是选择的科目号。

例:

3 2                           //3是他选择了3科。2表示选择了两个类别

0123 9876 2222           //这是他选择的详细的3科科目的科目号

2 1 8888 2222                 //当中2表示在这个类别里共同拥有两科8888和2222,然后最少要选择这两个中的一个

3 2 9876 2222 7654     //这是第二个类别。含义同上。

Sample Input

3 2
0123 9876 2222
2 1 8888 2222
3 2 9876 2222 7654
3 2
0123 9876 2222
2 2 8888 2222
3 2 7654 9876 2222
0

Sample Output

yes
no

题目链接:
https://vjudge.net/problem/POJ-2664

简单题,按照题意模拟一遍即可

AC代码

#include <iostream>
#include <cstdio>
#include <fstream>
#include <algorithm>
#include <cmath>
#include <deque>
#include <vector>
#include <queue>
#include <string>
#include <cstring>
#include <map>
#include <stack>
#include <set>
#include <sstream>
#define mod 1000000007
#define ll long long
#define INF 0x3f3f3f3f
#define ME0(x) memset(x,0,sizeof(x))
using namespace std;
int k,m,flag;
int a[];
int main()
{
while(cin>>k,k)
{
ME0(a);//每次都初始化数组
flag=;
cin >> m;
for(int i=; i<k; i++)
cin >> a[i];
sort(a,a+k);
for(int i=; i<m; i++)
{
int c,r,s;
s=;
cin >> c>>r;
for(int i=; i<c; i++)
{
int y;
cin >> y;
int t=lower_bound(a,a+k,y)-a;//判断有没有这个数
if(a[t]==y)
s++;
}
if(s<r)
flag=;
}
if(flag)
cout<<"yes"<<endl;
else
cout<<"no"<<endl;
}
return ;
}
												

最新文章

  1. [iOS]技巧集锦:UICollectionView内容下沉64像素原因和解决方案
  2. C#中线程对控件的访问
  3. lsof 命令 系统管理 系统监控
  4. 04 SQL是关于集合的
  5. WPF实现渐变淡入淡出的动画效果
  6. Brunch:快捷的HTML5构建工具
  7. docker基础入门之二
  8. Java log4j使用
  9. vivado2016.1下载程序出错:End of startup status: LOW
  10. 去除CKFinder版权提示信息
  11. NE76003单片机调试DS18B20 步骤
  12. shell 小工具
  13. HDU 5573 Binary Tree(构造题)
  14. eclipse配置mybatis xml文件自动提示(转)
  15. Python实现的复杂的计算器的代码
  16. Qt QpushButton 实现长按下功能
  17. 使用 TListView 控件(4)
  18. http1.0 和 http1.1 主要区别
  19. find命令之时间戳使用示例
  20. Ruby的DevKit名词解释

热门文章

  1. 从头学起-CLR的执行模型
  2. ios开发之自己定义默认生成的导航栏 标题 颜色 返回button
  3. python 爬虫1 開始,先拿新浪微博開始
  4. java中创建对象的五种方法
  5. UIView局部点击
  6. spring boot 使用Ehcache
  7. @SpringBootApplication 注解
  8. MyEclipse注释配置
  9. POJ - 2417 Discrete Logging(Baby-Step Giant-Step)
  10. ping 中的“TTL&quot;是什么意思