河南省大学生程序设计竞赛863软件园杯第一界试题
2009-05-13 04:05 Logic0 阅读(481) 评论(0) 编辑 收藏 举报第一题
灾区已经非常困难,灾民需要帐篷、衣物、食品和血浆。可通往灾区的道路到处都是塌方,70%以上的路面损坏,桥梁全部被毁。中国空军立即启动应急预案,展开史上最大强度非作战空运行动,准备向灾区空投急需物资。由于余震不断,天气恶劣,怎样知道空投的物资是否落在某灾区的区域内?
经过空中观测,多数灾区为一圆形,空投的物资落在P(Xj,Yj)点。你能否给出一个正确判断?
【标准输入】
第 1 行: N M (N为灾区数, M 为空投的物资数)
接下有N行:Xi0 Yi0 Ri (Xi0 ,Yi0)为圆心坐标, Ri为圆半径 i=1, 2, …., N
接下有M行:Xj Yj (Xj ,Yj)为空投物资的坐标 j=1, 2, …., M )
【标准输出】
输出有M行,每一行输出 YES 或 NO (若物资落在某个圆上或圆内,输出YES否则输出NO )
【约束条件】
(1) 1 ≤ N ≤ 3 2 ≤ M ≤ 10
(2) Ri 是一个正整数 Ri <=50 i=1, 2, …., N
(3) 所有的圆心坐标和物资的坐标均为整数 范围均在[-100,100]内
(4) 时间限制: 1000MS
【 样 例 】
标准输入 |
标准输出 |
2 3 0 0 20 -70 30 50 10 10 -30 60 30 30 |
YES YES NO |
第二题
据不完全统计,受地震影响,四川大部分灾区通信陷入瘫痪,数千个基站因断电、传输中断等原因退出服务,目前总公司已紧急部署对受灾地区进行通信抢修。按照应急通信保障预案,必须尽快、付出代价最小,效率更高来全力恢复通信。
由于四川大部分灾区都处于山区,有很多基站之间不能直接建立通信。现已知建立各基站之间直接通信的代价,问如何建立总代价最小的通信网,使得任意两个基站之间都能通信?
【标准输入】
第 1 行: N M (N为基站数 M为能直接建立通信关系数 )
接下有M行: I J P (每行有三个数。I J 为基站的编号,P为基站I与基站之间直接通信的代价)
【标准输出】
T (建立通信网的最小代价数)
【约束条件】
(1) 2 ≤ N ≤100 10 ≤ M ≤1000
(2) 0 < P ≤ 1000 P为正整数
(3) 时间限制: 1000MS
【 样 例 】
标准输入 |
标准输出 |
5 7 1 2 160 1 3 30 1 4 20 2 3 200 3 4 50 3 5 80 5 4 70 |
280 |
第三题
密码破译
某组织欲破获一个外星人的密码,密码由一定长度的字串组成。此组织拥有一些破译此密码的长度不同的钥匙,若两个钥匙的长度之和恰好为此密码的长度,则此密码被成功破译。现在就请你编程找出能破译此密码的两个钥匙。
【标准输入】
第 一 行: N N为钥匙的个数(1<=N<=1000)
第 二 行: L L为密码的长度
以下有N行: Ai 每一行是一把钥匙的长度 i=1,2,……,N
【标准输出】
若无法找到破译此密码的钥匙,则输出0
若找到两把破译的钥匙,则输出文件有两行,分别为两把钥匙的编号,按从小到大输出。若有多种破译方案,则只输出包含起始编号最小的一组即可。
【约束条件】
(1)1<= N,L,Ai <=1000 ( i=1, 2, ….., N )
(2)时间限制: 1000MS
【 样 例 】
标准输入 |
标准输出 |
10 80 27 9 4 73 23 68 12 64 92 16 |
6 7 |
第四题
在灾区,多数人已经受伤,缺水,少食物,精神处在崩溃的边缘。很多人的生存条件仅能维持几天。灾民需要帐篷、衣物、食品和医疗器材、药品等物资。14日上午,中央军委委员、空军司令员许其亮组织召开空军首长办公会,将空军下一步救灾重点确定为抢救伤员、空投、空运。空军各部队都派出多架运输机,准备向灾区空运急需物品。
现在已知四种打包过的急需物品重量分别为C1, C2, C3,C4 ,数量分别为M1,M2,M3,M4包。一架运输机的载重量为W, 现在各部队关心将一架运输机装满共有多少种运载方案,以便调度进行空运。
比如C={ 100, 200, 500, 1000}, M={ 3, 2, 3, 1 }, W=1000, 一共有4种运载方案:
1000=100+100+100+200+500
1000=100+200+200+500
1000=500+500
1000=1000
【标准输入】
第一行: C
接下来n行: Mi
【标准输出】
输出有N行,表示各部队运载物品的方案总数,保证答案在10000范围内
【约束条件】
(1)0< Cj <= 1000 0 <= Mij <= 500 i =1,2,….. , N j =1,2,3,4
(2)N<=1000 0 < Wi <= 100000 i =1,2,….. , N
(3)时间限制: 1000MS
【 样 例 】
标准输入 |
标准输出 |
1 2 5 10 2 |
4 27 |
3 2 3 1 10 | |
1000 2 2 2 900 |
第五题
从
由于通往各灾区的道路完全中断,大批救援物资只好空投到各个灾区。某军区准备了一批物资, 恰好能均分到处于环形的N个灾区中。遗憾的是,由于余震不断,天气恶劣等原因,落到各灾区的数量不相同。
正如***总理所一再强调的“抢救人的生命,是这次救灾工作的重中之重” 。为了保证救灾的效率不会平白消耗, 当地的民间救助组织可以选择将落到自己所在区的物资传送到左边或者右边相邻的灾区。为了公平起见,我们希望通过相邻灾区的相互传送,最终使所有的灾区获得相同数量的物资。假设一个物资从一个灾区传送到另一个灾区付出的代价是1, 问怎样进行传送,使得所付出的总代价最小。
【标准输入】
第 一 行: N 表示处于环形的灾区数
接下来n行: 每行一个整数Ai, 表示第i个灾区得到的物质数量。
【标准输出】
输出只有一个数, 表示传送物资付出的最小总代价
【约束条件】
(1) N<=1000000
(2) Ai>=0, 保证Ai在长整型范围内, Ai的总和在int64/long long范围内.
(3) 时间限制: 1000MS
【 样 例 】
标准输入 |
标准输出 |
4 |
4 |
1 | |
2 | |
5 | |
4 |
第六题
Time Limit: 1000MS
The disaster is order, and the time is life. Relief troops must reach the disaster scene as fast as possible. At 10:00 on the 13th, in the disaster relief headquarters of the Chengdu Military Area, Li Shiming, commander of the Chengdu Military Area Command, shouted loudly :"No matter generals or soldiers, whoever reach the quake-hit areas in the earliest time will be awarded the glory."
We may assume that all the soldiers except "Yongshi" run from
We assume the distance from
【Input】
There are several test cases (<=10 test cases). The first line of each case is N (1 <= N <= 1000) representing the number of soldier (excluding Yongshi ). N = 0 ends the input. The following N lines are information of N different soldiers, in such format: Vi Ti Vi is a positive integer <= 30, indicating the speed of the i-th soldier (kph, kilometers per hour). Ti is the set off time of the i-th soldier, which is an integer and counted in minutes. In any case it is assured that there always exists a nonnegative Ti. -1000<= Ti <=1000
【Output 】
Output one line for each case: the arrival time of Yongshi. Round up (ceiling) the value when dealing with a fraction.
Sample Input Sample Output
4 214
10 0 271
12 -15
15 19
30 24
2
21 0
22 34
0
第七题
George took sticks of the same length and cut them randomly until all parts became at most 20 units long. Now he wants to return sticks to the original state, but he forgot how many sticks he had originally and how long they were originally. Please help him and design a program which computes the smallest possible original length of those sticks. All lengths expressed in units are integers greater than zero.
【Input】
Input consists of multiple problem instances. Each instance contains blocks of 2 lines. The first line contains the number of sticks parts after cutting, there are at most 64 sticks. The second line contains the lengths of those parts separated by the space. The last line of the file contains zero.
【Output】
The output should contains the smallest possible length of original sticks, one per line.
Sample Input
9
5 2 1 5 2 1 5 2 1
4
1 2 3 4
0
Sample Output
6
5
Time Limit: 1000MS
第八题
An ascending sorted sequence of distinct values is one in which some form of a less-than operator is used to order the elements from smallest to largest. For example, the sorted sequence A, B, C, D implies that A < B, B < C and C < D. in this problem, we will give you a set of relations of the form A < B and ask you to determine whether a sorted order has been specified or not.
【Input】
Input consists of multiple problem instances. Each instance starts with a line containing two positive integers n and m. the first value indicated the number of objects to sort, where 2 <= n <= 26. The objects to be sorted will be the first n characters of the uppercase alphabet. The second value m indicates the number of relations of the form A < B which will be given in this problem instance. 1 <= m <= 100. Next will be m lines, each containing one such relation consisting of three characters: an uppercase letter, the character "<" and a second uppercase letter. No letter will be outside the range of the first n letters of the alphabet. Values of n = m = 0 indicate end of input.
【Output】
For each problem instance, output consists of one line. This line should be one of the following three:
Sorted sequence determined: y y y… y. y y y… y is the sorted, ascending sequence.
Sorted sequence cannot be determined.
Inconsistency found.
Sample Input Sample Output
4 6 Sorted sequence determined: A B C D.
A<B Inconsistency found.
A<C Sorted sequence cannot be determined.
B<C
C<D
B<D
A<B
3
B<A
26
A<Z
D<S
0 0