POJ 2028 When Can We Meet? (又是一道水题)

【题目简述】:N代表有几个会员,Q代表有几个会员的时候开会才算做有效,接下来N行,每行第一个数字代表这行有M个数,说明这个会员在哪几天有时间。最后让我们求出  最快  哪天开会。

【分析】:简单题,见代码。

//  248K 47Ms
#include<iostream>
using namespace std;

int M[101];
int N,Q;

int main()
{
	int m;
	int m1;
	while(1)
	{
		cin>>N>>Q;
		if(N == 0&&Q == 0 )
			break;
		memset(M,0,sizeof(M));
		while(N--)
		{
			cin>>m;
			for(int i =0;i<m;i++)
			{
				cin>>m1;
				M[m1]++;
			}
		}
		int Max = 0;

		int a;
		for(int j = 0;j<=100;j++)
		{
			if(M[j]>Max){
				Max = M[j];
				a = j;
			}
		}
		if(Max>=Q)
			cout<<a<<endl;
		else
			cout<<"0"<<endl;
	}
	return 0;
}
时间: 2024-08-05 06:49:32

POJ 2028 When Can We Meet? (又是一道水题)的相关文章

POJ 2501 Average Speed(不错的一道水题)

[题目简述]:给出我们时间和速度,让我们求出走了多远的距离 [分析]:这道题开始的时候没有太明白什么时候输出,后来看了别人的题解就明白了. 关于此题的几点总结: 1.时间的输入方法:scanf("%d:%d:%d",&h,&m,&s),注意积累! 2.关于空格的的输入控制使用char ch = getchar(),同时它还作为了本题的一个是否输出的标识控制的条件. 3.多积累类似题目的方法. 代码参考http://blog.csdn.net/yujuan_mao

北方多校 又是一道简单题

又是一道简单题 12000ms 65536K 给出一棵有根树,每次查询给出两个节点 u 和 v,假设节点 f 是u,v的最近公共祖先,请查询以 f 为根的子树中,不在 u 到 v 这条链上且标号最小的节点. 输入格式 第一行输入正整数 T(T <= 30),表示共有T组输入数据. 对于每组数据,第一行输入两个正整数 n,m(n <= 50000,m <= 50000),表示节点数和询问数,节点编号 1 到 n,其中 1 是根节点. 接下来 n - 1 行,每行输入两个正整数u,v,表示标

又是一道模拟题吧!

题目如下:This cheeseburger you don't need Description Yoda: May the Force be with you. Master Yoda is the oldest member of the Jedi Council. He conducts preparatory classes of little Younglings up to the moment they get a mentor. All Younglings adore mas

POJ 1269 Intersecting Lines(线段相交,水题)

Intersecting Lines 大意:给你两条直线的坐标,判断两条直线是否共线.平行.相交,若相交,求出交点. 思路:线段相交判断.求交点的水题,没什么好说的. struct Point{ double x, y; } ; struct Line{ Point a, b; } A, B; double xmult(Point p1, Point p2, Point p) { return (p1.x-p.x)*(p2.y-p.y)-(p1.y-p.y)*(p2.x-p.x); } bool

POJ - 3006 - Dirichlet&#39;s Theorem on Arithmetic Progressions = 水题

http://poj.org/problem?id=3006 给一个等差数列,求其中的第n个质数,答案保证不超过1e6.n还特别小?!!! 埃筛之后暴力. #include<algorithm> #include<cmath> #include<cstdio> #include<cstring> #include<iostream> #include<map> #include<set> #include<stack

POJ 2028 When Can We Meet?

Time Limit: 1000MS   Memory Limit: 30000K Total Submissions: 5158   Accepted: 2844 Description The ICPC committee would like to have its meeting as soon as possible to address every little issue of the next contest. However, members of the committee

POJ 2726 Holiday Hotel 一道水题

貌似是当年楼教主出的题目. 有N个旅店,两个属性,距离D,价格C.选择旅店,若选择M 1.比M近的,价格比它高 2.比M便宜的,距离比它远 求有多少个这样的旅店 ① 暴力做法 两次排序,按照不同的关键字.然后扫描,过程中记录下前面另一个关键字的最小值,然后比较.若数组中sel为2则是. #include<cstdio> #include<cstdlib> #include<cstring> #include<iostream> #include<alg

Report,又是一道思维题

题目: Each month Blake gets the report containing main economic indicators of the company "Blake Technologies". There are n commodities produced by the company. For each of them there is exactly one integer in the final report, that denotes corres

POJ 2342 &amp;&amp;HDU 1520 Anniversary party 树形DP 水题

一个公司的职员是分级制度的,所有员工刚好是一个树形结构,现在公司要举办一个聚会,邀请部分职员来参加. 要求: 1.为了聚会有趣,若邀请了一个职员,则该职员的直接上级(即父节点)和直接下级(即儿子节点)都不能被邀请 2.每一个员工都有一个兴奋值,在满足1的条件下,要使得邀请来的员工的兴奋值最高 输出最高的兴奋值. 简单的树形DP dp[i][1]:表示以i为根的子树,邀请节点i的最大兴奋值 dp[i][0]:表示以i为根的子树,不邀请节点i的最大兴奋值 先根据入度找出整棵树的根节点, 然后一次DF