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. 数据存储--sqlite总结

    SQLite SQLite(轻量级的数据库,关系型数据库) 辅助工具:Navicat Premium 等 原理:ios针对存储问题封装了sqlite数据库(c语言数据库). 1 app获取沙盒地址命名 ...

  2. 高效使用你的Xcode

    (via:VongLo's Dev Space  原文:Supercharging Your Xcode Efficiency)   好莱坞电影里经常看到黑客们手指在键盘上飞速跳跃,同时终端上的代码也 ...

  3. Android 菜单定制使用小结

    GridView 添加 ArrayAdapter<Bean>, 在 gridView 的 Item 点击之后, 1.list.add(bean)/remove(bean) 2.adapte ...

  4. 警告 - no rule to process file 'WRP_CollectionView/README.md' of type net.daringfireball.markdown for architecture i386

    warning: no rule to process file '/Users/mac/Downloads/Demo/Self/WRP_CollectionView/WRP_CollectionVi ...

  5. CSDN-markdown编辑器

    欢迎使用Markdown编辑器写博客 本Markdown编辑器使用StackEdit修改而来,用它写博客,将会带来全新的体验哦: Markdown和扩展Markdown简洁的语法 代码块高亮 图片链接 ...

  6. JQ 练习题

    1.留言板 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w ...

  7. HTML5学习之画布和SVG(四)

    <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <m ...

  8. Delphi中线程类TThread实现多线程编程1---构造、析构……

    参考:http://www.cnblogs.com/rogee/archive/2010/09/20/1832053.html Delphi中有一个线程类TThread是用来实现多线程编程的,这个绝大 ...

  9. 终于看完<LEARNING SQL>第二版,立此存照

  10. shell test 數值 字符串 文件比較

    數值比較 描述 n1 –eq n2 等於 n1 –gt  n2 大於 n1 –ge n2 大於等於 n1 –lt  n2 小於 n1 –le n2 小於等於 n1 –ne n2 不等於   字符串比較 ...