| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1869 人关注过本帖, 2 人收藏
标题:[讨论]]第十四期编程题目
取消只看楼主 加入收藏
crackerwang
Rank: 3Rank: 3
等 级:新手上路
威 望:8
帖 子:833
专家分:0
注 册:2007-2-14
收藏(2)
 问题点数:0 回复次数:4 
[讨论]]第十四期编程题目

When Can We Meet?
Time Limit:1000MS Memory Limit:30000K
Total Submit:568 Accepted:368

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 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//其实就就是在给定的几个数组中找到最小的切重复次数大于或等于要求次数的数字

Tri Tiling
Time Limit:1000MS Memory Limit:65536K
Total Submit:1919 Accepted:905

Description
In how many ways can you tile a 3xn rectangle with 2x1 dominoes?
Here is a sample tiling of a 3x12 rectangle.

Input
Input consists of several test cases followed by a line containing -1. Each test case is a line containing an integer 0 <= n <= 30.

Output
For each test case, output one integer number giving the number of possible tilings.

Sample Input

2
8
12
-1

Sample Output

3
153
2131
//第二个可能比较难一点.
希望大家积极参与..注意程序的输出格式尽量和sample output一样.以便我为大家提交.不要输出任何提示输入的信息
搜索更多相关主题的帖子: 题目 讨论 
2007-05-11 08:29
crackerwang
Rank: 3Rank: 3
等 级:新手上路
威 望:8
帖 子:833
专家分:0
注 册:2007-2-14
收藏
得分:0 

看来第一个题目很多人没有看懂:
题意:召开一个需要至少N个人的会议.虽然侯选人很多,但是很多人都是很忙的.于是会议的主办方要他们投递一个自己的时间表过来.你的任务是根据投递过来的时间表来确定最早的开会时间;
输入:
T//代表的是测试数据一共有多少组
N//代表的是至少需要的开会人数
.
.
//接下来的N行分别代表的是第i个人的时间表.时间表的格式如下
k (代表的是该议员有K个空闲时间) M1,m2,...Mk,//分别代表的是空闲日期(日期表示的是从今天起的第几天)
输出
输出符合要求的离今天最近的日期.

PS.题目的的sample input有一个小小的错误
第一行的 3 2
应该是
3
2///其实也不影响答案


2007-05-11 12:16
crackerwang
Rank: 3Rank: 3
等 级:新手上路
威 望:8
帖 子:833
专家分:0
注 册:2007-2-14
收藏
得分:0 
以下是引用yu_hua在2007-5-11 14:26:53的发言:

//第二道题的编程(代码已优化,速度加快了)
#include <stdio.h>
long fun(int a,int b,int c)
{ if(a*b*c==0)
return 1;
else if(a<0||b<0||c<0)
return 0;
else if(a==b&&b==c)
return 2*fun(a-2,b-1,c-1)+fun(a-2,b-2,c-2);
else if(a<b&&b==c)
return fun(a,b-1,c-1)+fun(a-2,b-2,c-2);
else return 0;
}
main( )
{
int n;
while(1){
scanf("%d",&n);
if(n<0)break;
printf("%ld\n",fun(n,n,n));}
}

除了奇数的时候应该输入0之外.其他都是对.楼上写的不错.下次题目就由你来出了


2007-05-11 16:26
crackerwang
Rank: 3Rank: 3
等 级:新手上路
威 望:8
帖 子:833
专家分:0
注 册:2007-2-14
收藏
得分:0 

第一个怎么没有人做啊?
难道是因为太简单了或没有看懂?


2007-05-11 16:40
crackerwang
Rank: 3Rank: 3
等 级:新手上路
威 望:8
帖 子:833
专家分:0
注 册:2007-2-14
收藏
得分:0 
回复:(Javal)3 22 1 403 3 4 83 2 // 这里应该是 ...

思路很正确!!
答案应该没有什么问题.

[此贴子已经被作者于2007-5-11 18:13:22编辑过]


2007-05-11 18:11
快速回复:[讨论]]第十四期编程题目
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.035765 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved