Prerequisites?
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 1220 Accepted Submission(s): 698

Problem Description
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?

Input
Input consists of several test cases. For each case, the first line of input contains 1 ≤ k ≤ 100, the number of courses Freddie has chosen, and 0 ≤ m ≤ 100, the number of categories. One or more lines follow containing k 4-digit integers follow; each is the number of a course selected by Freddie. Each category is represented by a line containing 1 ≤ c ≤ 100, the number of courses in the category, 0 ≤ r ≤ c, the minimum number of courses from the category that must be taken, and the c course numbers in the category. Each course number is a 4-digit integer. The same course may fulfil several category requirements. Freddie's selections, and the course numbers in any particular category, are distinct. A line containing 0 follows the last test case.

Output
For each test case, output a line containing "yes" if Freddie's course selection meets the degree requirements; otherwise output "no."

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

#include<stdio.h>
int main()
{
int k,m,c,r,d,i,j,l,flag,res,a[];
while(scanf("%d%d",&k,&m),k)
{
flag=;
for(i=;i<k;i++)
scanf("%d",&a[i]);
for(i=;i<m;i++)
{
scanf("%d%d",&c,&r);
res=;
for(j=;j<c;j++)
{
scanf("%d",&d);
for(l=;l<k;l++)
if(d==a[l])
res++;
}
if(res>=r)
continue;
else
flag=;
}
if(flag)
printf("yes\n");
else
printf("no\n");
}
return ;
}

Prerequisites?[HDU1144]的更多相关文章

  1. zabbix-check of pre-requisites

    LAMP搭建完成后,访问http://ip/zabbix,在检查环境界面,有的检查项目提示fail.常见如下:zabbix:Check of pre-requisites1.PHP bcmath fa ...

  2. The IBM Blockchain Platform: Develop pre-requisites

    Installing pre-requisites The IBM Blockchain Platform: Develop pre-requisites can be installed on Ub ...

  3. 【POJ - 2664】Prerequisites? (排序+查找)

    Prerequisites? 原文是English,这里直接就写中文吧 题意简述 k:已经选择的科目数:m:选择的科目类别:c:能够选择的科目数.r:要求最少选择的科目数量 在输入的k和m以下的一行是 ...

  4. Visual Studio 2013 prerequisites

    http://www.visualstudio.com/zh-cn/products/visual-studio-ultimate-with-msdn-vs#Fragment_SystemRequir ...

  5. Hbase Basic Prerequisites

    Table 2. Java HBase Version   JDK 6      JDK 7       JDK 8 1.0 Not     Supported yes Running with JD ...

  6. 弹指之间 -- Prerequisites

    CHAPTER 1 吉他的分类 Electric Guitar Classic Guitar Folk Guitar CHAPTER 2 吉他各部名称 CHAPTER 3 选购吉他 琴颈弯曲程度 木头 ...

  7. POJ 2664 Prerequisites?(简单题)

    [题意简述]:k:已经选择的科目数:m:选择的科目类别:c:能够选择的科目数.r:要求最少选择的科目数量 在输入的k和m以下的一行是选择的科目号. 比如: 3 2 //3是他选择了3科.2表示选择了两 ...

  8. 说说Makefile那些事儿

    说说Makefile那些事儿 |扬说|透过现象看本质 工作至今,一直对Makefile半知半解.突然某天幡然醒悟,觉得此举极为不妥,只得洗心革面从头学来,以前许多不明觉厉之处顿时茅塞顿开,想想好记性不 ...

  9. 基于Oracle安装Zabbix

    软件版本 Oracle Enterprise Linux 7.1 64bit Oracle Enterprise Edition 12.1.0.2 64bit Zabbix 3.2.1 准备工作 上传 ...

随机推荐

  1. tar 只解压tar包中某个文件

    sh-4.1# ls test.tar sh-4.1# tar -tf test.tar ./ecs20161207.png ./ecs.png ./ecs.xml ./rds.png ./Scree ...

  2. Clr Via C#读书笔记---CLR寄宿和应用程序域

    #1 CLR寄宿: 开发CLR时,Microsoft实际是将他实现成包含在一个dll中的COM服务器.Microsoft为CLR定义了一个标准的COM接口,并为该接口和COM服务器分配了GUID.安装 ...

  3. Win7 DCOM 配置中我的电脑出现红色箭头并且无属性显示的解决方法

    http://blog.csdn.net/embededvc/article/details/19234479

  4. 跳跃表Skip List的原理和实现

    >>二分查找和AVL树查找 二分查找要求元素可以随机访问,所以决定了需要把元素存储在连续内存.这样查找确实很快,但是插入和删除元素的时候,为了保证元素的有序性,就需要大量的移动元素了.如果 ...

  5. 重温WCF之数据契约和序列化(四)

    一.数据契约 1.使用数据协定可以灵活控制哪些成员应该被客户端识别. [DataContract] public class Employee { [DataMember] public string ...

  6. Android OkHttp完全解析 --zz

    参考文章 https://github.com/square/okhttp http://square.github.io/okhttp/ 泡网OkHttp使用教程 Android OkHttp完全解 ...

  7. WMSYS.WM_CONCAT 函數的用法

    select t.rank, t.Name from t_menu_item t; 10 CLARK    10 KING    10 MILLER    20 ADAMS    20 FORD    ...

  8. POJ2778 DNA Sequence(AC自动机 矩阵)

    先使用AC自动机求得状态转移关系,再建立矩阵,mat[i][j]表示一步可从i到j且i,j节点均非终止字符的方案数,则此矩阵的n次方表示n步从i,到j的方法数. #include<cstdio& ...

  9. php+jquery+ajax实现用户名验证

    大多数情况下,jquery代码的编写,都要求我们将jquery的代码放在以下三种中任一个function里. 有三种写法,同样效果,有点像Window.onload,但也有不同,就是window.on ...

  10. WebRTC代码走读(十):rtp_rtcp模块分析,webrtcrtp_rtcp

    转自:http://www.bkjia.com/Androidjc/1020017.html 1. 对外提供的主要流程接口       收包的调用接口RtpReceiverImpl::Incoming ...