- 1
- 0
- 约1.27万字
- 约 9页
- 2017-12-12 发布于河南
- 举报
第三届ACM程序设计大赛试题new
计算机工程学院
第三届ACM程序设计大赛试题
Problem A Bridge
Descriptionn people wish to cross a bridge at night. A group of at most two people may cross at any time, and each group must have a flashlight. Only one flashlight is available among the n people, so some sort of shuttle arrangement must be arranged in order to return the flashlight so that more people may cross. Each person has a different crossing speed; the speed of a group is determined by the speed of the slower member. Your job is to determine a strategy that gets all n people across the bridge in the minimum time.
Input
The first line of input contains n, followed by n lines giving the crossing times for each of the people. There are not more than 1000 people and nobody takes more than 100 seconds to cross the bridge.
OutputThe first line of output must contain the total number of seconds required for all n people to cross the bridge. The following lines give a strategy for achieving this time. Each line contains either one or two integers, indicating which person or people form the next group to cross. (Each person is indicated by the crossing time specified in the input. Although many people may have the same crossing time the ambiguity is of no consequence.) Note that the crossings alternate directions, as it is necessary to return the flashlight so that more may cross. If more than one strategy yields the minimal time, any one will do.
Sample Input(Input file: pa.txt)
4
1
2
5
10
Sample Output
17
1 2
1
5 10
2
1 2
Problem B Lotto
Description
In the German Lotto you have to select 6 numbers from the set {1,2,...,49}. A popular strategy to play Lotto - although it doesnt increase your chance of winning - is to select a subset S containing k (k 6) of these 49 numbers, and then play several games with choosing numbers only from S. For example, for k=8 and S = {1,2,3,5,8,13,21,34} there are 28 possible games: [1,2,3,5,8,13], [1,2,3,5,8,21], [1,2,3,5,8,34], [1,2,3,5,13,21], ... [3,5,8,13,21,34]. Your job is to
您可能关注的文档
- 最新高考英语好作文必背短语、句型.doc
- Sublist 6例句版.doc
- 2013高考英语总复习人教版2-1.doc
- 1 公司运作与管理.docx
- 必背哲学原理.doc
- 我整理英文写作必背句型(转载).docx
- 逆变弧焊电源峰值电流模式双闭环控制系统的研究.doc
- 网络游戏对当代青年影响.doc
- 提高英语专四作文分数的88个句型.doc
- 《词汇风暴》按字母顺序词汇典句精华梳理.doc
- 中国国家标准 GB/Z 37551.300-2026海洋能 波浪能、潮流能及其他水流能转换装置 第300部分:河流能转换装置发电性能评估.pdf
- GB/T 44937.3-2025集成电路 电磁发射测量 第3部分:辐射发射测量 表面扫描法.pdf
- 中国国家标准 GB/T 44937.3-2025集成电路 电磁发射测量 第3部分:辐射发射测量 表面扫描法.pdf
- 《GB/T 44937.3-2025集成电路 电磁发射测量 第3部分:辐射发射测量 表面扫描法》.pdf
- 中国国家标准 GB/T 44937.1-2025集成电路 电磁发射测量 第1部分:通用条件和定义.pdf
- GB/T 44937.1-2025集成电路 电磁发射测量 第1部分:通用条件和定义.pdf
- 《GB/T 44937.1-2025集成电路 电磁发射测量 第1部分:通用条件和定义》.pdf
- 中国国家标准 GB/T 4937.37-2025半导体器件 机械和气候试验方法 第37部分:采用加速度计的板级跌落试验方法.pdf
- 《GB/T 4937.10-2025半导体器件 机械和气候试验方法 第10部分:机械冲击 器件和组件》.pdf
- 中国国家标准 GB/T 44937.2-2025集成电路 电磁发射测量 第2部分:辐射发射测量TEM小室和宽带TEM小室法.pdf
原创力文档

文档评论(0)