ZOJ 1715 When Can We Meet?

告别迷茫!用ETAS RTA-OS配置你的第一个AUTOSAR OS任务(含VRTA虚拟ECU实战) 本文详细介绍了如何使用ETAS RTA-OS工具链在VRTA虚拟ECU上配置和运行第一个AUTOSAR OS任务。通过从XML配置到任务调度的全流程实战,帮助开发者快速掌握嵌入式操作系统开发的核心步骤,特别适合刚接触AUTOSAR的开发者快速上手。 阅读详情
When Can We Meet?

Time Limit: 2 Seconds      Memory Limit: 65536 KB

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 are so busy maniacally developing (possibly useless) programs that it is very difficult to arrange their schedules for the meeting. So, in order to settle the meeting date, the chairperson requested every member to send back a list of convenient dates by E-mail. Your mission is to help the chairperson, who is now dedicated to other issues of the contest, by writing a program that chooses the best date from the submitted lists. Your program should find the date convenient for the most members. If there is more than one such day, the earliest is the best.


Input

The input has multiple data sets, each starting with a line containing the number of committee members and the quorum of the meeting.

N Q

Here, N, meaning the size of the committee, and Q meaning the quorum, are positive integers. N is less than 50, and, of course, Q is less than or equal to N.

N lines follow, each describing convenient dates for a committee member in the following format.

M Date1 Date2 ... DateM 

Here, M means the number of convenient dates for the member, which is an integer greater than or equal to zero. The remaining items in the line are his/her dates of convenience, which are positive integers less than 100, that is, 1 means tomorrow, 2 means the day after tomorrow, and so on. They are in ascending order without any repetition and separated by a space character. Lines have neither leading nor trailing spaces.

A line containing two zeros indicates the end of the input.


Output

For each data set, print a single line containing the date number convenient for the largest number of committee members. If there is more than one such date, print the earliest. However, if no dates are convenient for more than or equal to the quorum number of members, print 0 instead.


Sample Input

3 2
2 1 4
0
3 3 4 8
3 2
4 1 5 8 9
3 2 5 9
5 2 4 5 7 9
3 3
2 1 4
3 2 5 9
2 2 4
3 3
2 1 2
3 1 2 9
2 2 4
0 0


Sample Output

4
5
0
2

题意:就是输入每个人有空的时间,看看多数人在哪天有空,就输出哪天
代码:
#include <stdio.h>


int main()
{
    int N,Q;
    int M;
    int i,j;
    
    while(scanf("%d",&N)&&scanf("%d",&Q))
    {
        int t,max,max_i=1;
        if(N==0&&Q==0)
            break;
        int a[101]={0};
        for(i=0;i<N;i++)
        {
            scanf("%d",&M);
            for(j=0;j<M;j++)
            {
                scanf("%d",&t);
                a[t]++;
            }
        }
        max=a[1];
        for(i=2;i<=100;i++)
        {
            if(a[i]>max)
            {
                max=a[i];
                max_i=i;
            }
        }
        printf("%d\n",max>=Q?max_i:0);
    }
    return 0;
}


//用t代表哪一天有空,a[t]代表那一天出现的次数,注意数组要大,不然时间会超限。。还有定义a[100]的话a[100]无意义
Django 小实例S1 简易学生选课管理系统 —— 〇、初步介绍与演示 python Django实现的一个简易的教务选课系统。 介绍与演示的视频版本已发到我的b站: https://www.bilibili.com/video/BV1er4y1w7ty。 项目已上传到我的github: https://github.com/BigShuang/SimpleStudentCourseManagementSystem。 S1总目录: 〇、初步介绍与演示 一、项目流程梳理与数据库设计 ======================= 大爽歌作,made by big shuang. 阅读详情

相关推荐

开关电源的纹波和噪声电压-抑制方法

开关电源(包括AC/DC转换器、DC/DC转换器、AC/DC模块和DC/DC模块)与线性电源相比较,最突出的优点是转换效率高,一般可达80%~85%,高的可达90%~97%;其次,开关电源采用高频变压器替代了笨重的工频变压器,不仅重量减轻,体积也减小了,因此应用范围越来越广。 但开关电源的缺点是由于其开关管工作于高频开关状态,输出的纹波和噪声电压较大,一般为输出电压的1%左右(低的为输出电压的0.5%左右),最好产品的纹波和噪声电压也有几十mV;而线性电源的调整管工作于线性状态,无纹波电压,输出的噪声电压也

ltqdxl的博客 1万+

zoj 1715 When Can We Meet?

水题。。。 在找出最多个会议成员空闲的公共时间相同的情况下输出最早的时间 #include int main() { int n,q,m,i,num[105],x,max; while(scanf("%d%d",&n,&q)!=EOF) { if(n==0&&q==0)break; for(i=0;i<105;i++)num[i]=0; while(n--)

YYlxid————Nothing is possible if not try~ 676

YOLO26改进策略【Neck】| CVPR2025 LCA轻量交叉注意力 跨层级双向引导 + 分层降噪增强,提升微小目标特征表达

简单相加、拼接融合无法建立深浅层双向约束关系,浅层微小目标易被深层背景覆盖,深层全局信息难以修正浅层噪声;普通单路自注意力仅单一层内建模依赖,缺少跨层级特征互引导机制,深浅特征信息割裂;标准多头跨注意力计算量大、参数量高,轻量化单模态检测/分割网络部署困难,无法区分前景目标与背景噪声。为此设计单模态轻量化交叉注意力LCA,构建浅层细节、深层语义双分支双向引导结构,轻量完成跨层级特征交互,同步降噪并强化单模态微小目标特征。

Limiiiing的博客 433

zoj 1715 When Can We Meet?(水~)

<br />额。水题。<br /> <br />崩溃的是我看错题了,绕了好多弯路。。。呜呜。。。啥破眼神。。。<br /> <br />不能主观臆断主观臆断啊啊啊啊。。。<br /> <br /> <br /> <br />#include <iostream> using namespace std; int main(void) { int N,Q,i,j,M; int state[50][102],sum[102],len,maxlen,x,maxnum,tempi;

小媛在努力~ 1144

2028 When Can We Meet?

<br />这个题虽然挺简单的,但是这个题的思路挺好的,有必要记下来。思路是:将每个人的日期记在一个一维数组里,求得每个日期有多少人参加,从该数组中找第一个最大的值,并且该值必须大于q,则该值就是所要求的值,如果没有这样的值,就输出0。代码如下:<br />#include "stdio.h" #include "string.h" int main() { freopen("in.txt","r",stdin); int n,q; int i,j,k; int m[101]; w

成长的足迹 1067

1715 When Can We Meet?

#include int main() { int n,q,m,date,max,i; int a[100]; while(scanf("%d%d",&n,&q)&&n){ for(i = 0;i<100;i++) a[i] = 0; while(n--){ scanf("%d",&m); while(m--){ scanf("%d",&date);

andy的专栏 413

(简单)When Can We meet?

#include #include #include #include #include using namespace std; int main() { freopen("fuck.txt","r",stdin); int i,j,k; int n; while (cin>>n>>k,n) { int go[101]={0}; while (n--) { c

jiangjiashi的博客 1140

ZOJ1715 POJ2028 When Can We Meet? 简单的数组题

很简单,我用了vector来做。注意ACM中数组这些都应该开大一点,否则会runtime error。 /*******************************************************************************

Neo Fung的专栏 1053

zoj1715---------------------When Can We Meet?

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 are so busy maniacally developing (possibly u

Life is Float. 547

zoj 1751 When Can We Meet?

#include "iostream" #include "memory.h" #include "algorithm" using namespace std; int num[100]; int ans[100]; int main() { int committe, quorum, M, i, j, temp1, temp2; bool tag; while (cin >> com

yzl_rex 551

ZOJ 2172 Symmetric Order

Symmetric Order Time Limit: 2 Seconds      Memory Limit: 65536 KB In your job at Albatross Circus Management (yes, it's run by a bunch of clowns), you have just finished writing a program whose

胖子加油! 1743

ZOJ 1113 u Calculate e

u Calculate e Time Limit: 2 Seconds      Memory Limit: 65536 KB Background A simple mathematical formula for e is where n is allowed to go to infinity. This can actually yield very acc

胖子加油! 1300

ZOJ 1001 A + B Problem

A + B Problem Time Limit: 2 Seconds      Memory Limit: 65536 KB Calculate a + b Input The input will consist of a series of pairs of integers a and b,separated by a space, one pair of inte

胖子加油! 1211

ZOJ 1073 Round and Round We Go

Round and Round We Go Time Limit: 2 Seconds      Memory Limit: 65536 KB Problem A cyclic number is an integer n digits in length which, when multiplied by any integer from 1 to n, yields a ��

胖子加油! 1128

ZOJ 1382 A Simple Task

A Simple Task Time Limit: 2 Seconds      Memory Limit: 65536 KB Given a positive integer n and the odd integer o and the nonnegative integer p such that n = o2^p. Example For n = 24, o = 3

胖子加油! 793

ZOJ 1110 Dick and Jane

Dick and Jane Time Limit: 2 Seconds      Memory Limit: 65536 KB Dick is 12 years old. When we say this, we mean that it is at least twelve and not yet thirteen years since Dick was born. Dick a

胖子加油! 733

ZOJ 1813 Biker's Trip Odometer

Biker's Trip Odometer Time Limit: 2 Seconds      Memory Limit: 65536 KB Most bicycle speedometers work by using a Hall Effect sensor fastened to the front fork of the bicycle. A magnet is attach

胖子加油! 721

ZOJ 2108 Elevator

Elevator Time Limit: 2 Seconds      Memory Limit: 65536 KB The highest building in our city has only one elevator. A request list is made up with N positive numbers. The numbers denote at which

胖子加油! 659

ZOJ 1871 Steps

Steps Time Limit: 2 Seconds      Memory Limit: 65536 KB One steps through integer points of the straight line. The length of a step must be nonnegative and can be by one bigger than, equal to, o

胖子加油! 654

ZOJ 1334 Basically Speaking

Basically Speaking Time Limit: 2 Seconds      Memory Limit: 65536 KB The Really Neato Calculator Company, Inc. has recently hired your team to help design their Super Neato Model I calculator. A

胖子加油! 653

ZOJ 1889 Ones

Ones Time Limit: 2 Seconds      Memory Limit: 65536 KB Given any integer 0 <= n <= 10000 not divisible by 2 or 5, some multiple of n is a number which in decimal notation is a sequence of 1's. H

胖子加油! 650

ZOJ 1394 Polar Explorer

Polar Explorer Time Limit: 2 Seconds      Memory Limit: 65536 KB Introduction You are a intrepid 2-dimensional explorer located at the northern polar reaches of a distant 2-dimensional planet

胖子加油! 634

基于RRT算法在3D机械臂路径规划中的工程实现,含固定障碍物的约束环境中,找到从起点构型到目标构型的无碰撞路径附matlab代码.html.rar

基于RRT算法在3D机械臂路径规划中的工程实现,含固定障碍物的约束环境中,找到从起点构型到目标构型的无碰撞路径附matlab代码.html

soc.zip_OCV SOC_ocv曲线_soc曲线_电池 SOC_电池SOC-OCV

一种锂离子电池SOC-OCV曲线的标定方法与流程,属于锂离子电池技术领域,具体设计一种锂离子电池的SOC-OCV曲线的标定方法。

上一篇: ZOJ 1713 Haiku Review
下一篇: ZOJ 1730 Crazy Tea Party
wpfengqi
博客等级 码龄14年 6粉丝 121原创
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值