| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 2452 人关注过本帖
标题:英文C语言题目求解决!
只看楼主 加入收藏
xiaoz214
Rank: 1
等 级:新手上路
帖 子:11
专家分:0
注 册:2009-8-28
结帖率:0
收藏
已结贴  问题点数:100 回复次数:30 
英文C语言题目求解决!
GROUP  A
Program 1: Doubles(TOJ 1930)——(a1.cpp)
  As part of an arithmetic competency program, your students will be given randomly generated lists of from 2 to 15 unique positive integers and asked to determine how many items in each list are twice some other item in the same list. You will need a program to help you with the grading. This program should be able to scan the lists and output the correct answer for each one. For example, given the list
1 4 3 2 9 7 18 22
your program should answer 3, as 2 is twice 1, 4 is twice 2, and 18 is twice 9.
Input Format: (a1.in)
  The input file will consist of one or more lists of numbers. There will be one list of numbers per line. Each list will contain from 2 to 15 unique positive integers. No integer will be larger than 99. Each line will be terminated with the integer 0, which is not considered part of the list. A line with the single number -1 will mark the end of the file. The example input below shows 3 separate lists. Some lists may not contain any doubles.
Output Format: (a1.out)
  The output will consist of one line per input list, containing a count of the items that are double some other item.
Sample Input:
1 4 3 2 9 7 18 22 0
2 4 8 10 0
7 5 11 13 1 3 0
-1
Sample Output:
3
2
0
Program 2: Stamps(TOJ 1701)——(b2.cpp)
  Everybody hates Raymond. He's the largest stamp collector on planet earth and because of that he always makes fun of all the others at the stamp collector parties. Fortunately everybody loves Lucy, and she has a plan. She secretly asks her friends whether they could lend her some stamps, so that she can embarrass Raymond by showing an even larger collection than his.
  Raymond is so sure about his superiority that he always tells how many stamps he'll show. And since Lucy knows how many she owns, she knows how many more she needs. She also knows how many friends would lend her some stamps and how many each would lend. But she'd like to borrow from as few friends as possible and if she needs too many then she'd rather not do it at all. Can you tell her the minimum number of friends she needs to borrow from?
Input Format: (b2.in)
  The first line contains the number of scenarios. Each scenario describes one collectors party and its first line tells you how many stamps (from 1 to 1000000) Lucy needs to borrow and how many friends (from 1 to 1000) offer her some stamps. In a second line you'll get the number of stamps (from 1 to 10000) each of her friends is offering.
Output Format: (b2.out)
  The output for every scenario begins with a line containing "Scenario #i:", where i is the number of the scenario starting at 1. Then print a single line with the minimum number of friends Lucy needs to borrow stamps from. If it's impossible even if she borrows everything from everybody, write impossible. Terminate the output for the scenario with a blank line.
Sample Input:
3
100 6
13 17 42 9 23 57
99 6
13 17 42 9 23 57
1000 3
314 159 265
Sample Output:
Scenario #1:
3
Scenario #2:
2
Scenario #3:
impossible
Program 3: Robot(TOJ 1025)——(a3.cpp)
  The Robot Moving Institute is using a robot in their local store to transport different items. Of course the robot should spend only the minimum time necessary when travelling from one place in the store to another. The robot can move only along a straight line (track). All tracks form a rectangular grid. Neighbouring tracks are one meter apart. The store is a rectangle N x M meters and it is entirely covered by this grid. The distance of the track closest to the side of the store is exactly one meter. The robot has a circular shape with diameter equal to 1.6 meter. The track goes through the center of the robot. The robot always faces north, south, west or east. The tracks are in the south-north and in the west-east directions. The robot can move only in the direction it faces. The direction in which it faces can be changed at each track crossing. Initially the robot stands at a track crossing. The obstacles in the store are formed from pieces occupying 1m x 1m on the ground. Each obstacle is within a 1 x 1 square formed by the tracks. The movement of the robot is controlled by two commands. These commands are GO and TURN.
  The GO command has one integer parameter n in {1,2,3}. After receiving this command the robot moves n meters in the direction it faces.
  The TURN command has one parameter which is either left or right. After receiving this command the robot changes its orientation by 90o in the direction indicated by the parameter.
The execution of each command lasts one second.
  Help researchers of RMI to write a program which will determine the minimal time in which the robot can move from a given starting point to a given destination.

Input Format: (a3.in)
  The input consists of blocks of lines. The first line of each block contains two integers M ≤ 50 and N ≤ 50 separated by one space. In each of the next M lines there are N numbers one or zero separated by one space. One represents obstacles and zero represents empty squares. (The tracks are between the squares.) The block is terminated by a line containing four positive integers B1 B2 E1 E2 each followed by one space and the word indicating the orientation of the robot at the starting point. B1, B2 are the coordinates of the square in the north-west corner of which the robot is placed (starting point). E1, E2 are the coordinates of square to the north-west corner of which the robot should move (destination point). The orientation of the robot when it has reached the destination point is not prescribed. We use (row, column)-type coordinates, i.e. the coordinates of the upper left (the most north-west) square in the store are 0,0 and the lower right (the most south-east) square are M - 1, N - 1. The orientation is given by the words north or west or south or east. The last block contains only one line with N = 0 and M = 0.

Output Format: (a3.out)
  The output contains one line for each block except the last block in the input. The lines are in the order corresponding to the blocks in the input. The line contains minimal number of seconds in which the robot can reach the destination point from the starting point. If there does not exist any path from the starting point to the destination point the line will contain -1.
Sample Input:
9 10
0 0 0 0 0 0 1 0 0 0
0 0 0 0 0 0 0 0 1 0
0 0 0 1 0 0 0 0 0 0
0 0 1 0 0 0 0 0 0 0
0 0 0 0 0 0 1 0 0 0
0 0 0 0 0 1 0 0 0 0
0 0 0 1 1 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
1 0 0 0 0 0 0 0 1 0
7 2 2 7 south
0 0
Sample Output:
12
Program 4: Arctic Network(TOJ1411)——(a4.cpp)
  The Department of National Defence (DND) wishes to connect several northern outposts by a wireless network. Two different communication technologies are to be used in establishing the network: every outpost will have a radio transceiver and some outposts will in addition have a satellite channel.
  Any two outposts with a satellite channel can communicate via the satellite, regardless of their location. Otherwise, two outposts can communicate by radio only if the distance between them does not exceed D, which depends of the power of the transceivers. Higher power yields higher D but costs more. Due to purchasing and maintenance considerations, the transceivers at the outposts must be identical; that is, the value of D is the same for every pair of outposts.
  Your job is to determine the minimum D required for the transceivers. There must be at least one communication path (direct or indirect) between every pair of outposts.
Input Format: (a4.in)
  The first line of input contains N, the number of test cases. The first line of each test case contains 1 ≤ S ≤ 100, the number of satellite channels, and S < P ≤ 500, the number of outposts. P lines follow, giving the (x,y) coordinates of each outpost in km (coordinates are integers between 0 and 10,000).
Output Format: (a4.out)
  For each case, output should consist of a single line giving the minimum D required to connect the network. Output should be specified to 2 decimal points.
Sample Input:
1
2 4
0 100
0 300
0 600
150 750
Sample Output:
212.13
Program 5: Guarding the Farm(TOJ3144)——(a5.cpp)
  The farm has many hills upon which Farmer John would like to place guards to ensure the safety of his valuable milk-cows.
  He wonders how many guards he will need if he wishes to put one on top of each hill. He has a map supplied as a matrix of integers; the matrix has N (1 < N ≤ 700) rows and M (1 < M < 700) columns. Each member of the matrix is an altitude H_ij (0 ≤ H_ij ≤ 10,000). Help him determine the number of hilltops on the map.
  A hilltop is one or more adjacent matrix elements of the same value surrounded exclusively by either the edge of the map or elements with a lower (smaller) altitude. Two different elements are adjacent if the magnitude of difference in their X coordinates is no greater than 1 and the magnitude of differences in their Y coordinates is also no greater than 1.
Input Format: (a5.in)
* Line 1: Two space-separated integers: N and M* Lines 2..N+1: Line i+1 describes row i of the matrix with M space-separated integers: H_ij.
Output Format: (a5.out)
* Line 1: A single integer that specifies the number of hilltops
Sample Input:
8 7
4 3 2 2 1 0 1
3 3 3 2 1 0 1
2 2 2 2 1 0 0
2 1 1 1 1 0 0
1 1 0 0 0 1 0
0 0 0 1 1 1 0
0 1 2 2 1 1 0
0 1 1 1 2 1 0
Sample Output:
3
搜索更多相关主题的帖子: C语言 英文 
2009-08-28 11:24
hyfl
Rank: 7Rank: 7Rank: 7
来 自:火星
等 级:黑侠
帖 子:113
专家分:552
注 册:2008-11-20
收藏
得分:9 

“一切高手都是从菜鸟炼成的!”1099285180@
2009-08-28 14:04
Kiu
Rank: 3Rank: 3
等 级:论坛游侠
帖 子:68
专家分:107
注 册:2009-7-31
收藏
得分:9 

2009-08-28 16:34
ucfhvqdo
Rank: 2
等 级:论坛游民
帖 子:13
专家分:49
注 册:2009-7-20
收藏
得分:9 
2009-08-28 20:56
xiaoz214
Rank: 1
等 级:新手上路
帖 子:11
专家分:0
注 册:2009-8-28
收藏
得分:0 
5个题  有会的牛人吗?
帮帮忙!!!!!!!!
2009-08-28 23:59
liangonejzh
Rank: 2
等 级:论坛游民
帖 子:20
专家分:18
注 册:2009-7-30
收藏
得分:9 
2009-08-29 08:12
liangonejzh
Rank: 2
等 级:论坛游民
帖 子:20
专家分:18
注 册:2009-7-30
收藏
得分:0 
好长的题目啊
2009-08-29 08:12
机器能
Rank: 2
等 级:论坛游民
帖 子:46
专家分:61
注 册:2009-8-24
收藏
得分:9 
翻译下:
A组
题目1:双打(TOJ 1930) - (a1.cpp)
  作为一个算术能力的计划的一部分,你的学生将获得随机生成2至15名单独特的正整数,并要求以确定每个列表项多少有些两次在同一个列表中的其他项目。你需要一个程序来帮助你的等级。这个程序应该能够扫描名单和每一个输出正确的答案。例如,给定的名单
1 4 3 2 9 7 18 22
你的程序应该回答3,2次1,4次2和18个的两倍9。
输入格式:(a1.in)
  输入文件将包括一个或多个电话。将有一个每行数字列表。每个列表将包含2至15独特的正整数。任何整数将大于99。每一行都将被终止与整数0,这是不被认为是列表的一部分。与单一的数字-1,0线将标志着该文件的末尾。输入下面的例子显示了3个独立的名单。有些列表可能不包含任何双打。
输出格式:(a1.out)
  输出将包括每行输入清单,其中载有项目双重其他一些项目数。
示例输入:
1 4 3 2 9 7 18 22 0
2 4 8 10 0
7 5 11 13 1 3 0
-1
示例输出:
3
2
0
题目2:邮票(TOJ 1701) - (b2.cpp)
  人人都恨雷蒙德。他是地球上最大的邮票收藏家,因为他总是让在邮票收藏家各方所有其他的乐趣。幸运的是人人都爱露西,她有一个计划。她偷偷问她的朋友是否能借给她一些邮票,让她可以通过展示尴尬更大的收集,他比雷蒙德。
  雷蒙德是如此肯定他的优势,他总是告诉他,有多少将展示邮票。自露西知道她拥有多少,她知道她需要更多。她还知道有多少朋友会借给她的一些邮票,有多少将给予每个。但她想借用尽可能少的朋友,如果她需要太多,那么她宁可不要做一切。你能告诉她的朋友,她需要的最低数目的贷款?
输入格式:(b2.in)
  第一行包含的场景。每一个场景描述一收藏家党和第一行告诉你有多少邮票(从1到1000000)露西需要借鉴,有多少朋友(从1至1000)提供她一些邮票。在第二行你会得到多少的邮票(从1到10000),她的朋友每一个产品。
输出格式:(b2.out)
  为每一个场景输出开始使用含有“#I行的情景:”在那里我是从1开始编号的情况。然后打印在朋友的最低数量露西需要借鉴邮票从单一线。如果这是不可能的,即使她借用了每个人的一切,写是不可能的。终止的情况下与一个空行输出。
示例输入:
3
100 6
13 17 42 9 23 57
99 6
13 17 42 9 23 57
1000 3
314 159 265
示例输出:
方案#1:
3
场景二:
2
方案#3:
不可能
题目3:机器人(TOJ 1025) - (a3.cpp)
  移动机器人研究所利用当地商店运输机器人不同的项目。当然,机器人应只花最少的时间从一个必要时在商店旅行到另一个地方。该机器人可以移动只能沿着一条直线(轨道)。所有轨道上形成一个矩形网格。邻近轨道1米之外。这家商店是一个长方形&ntilde;辆M米,完全是由这个网格范围。赛道的最接近商店的一面正是距离一米。该机器人有一个直径等于1.6米的圆形。这条赛道穿过机器人的中心。该机器人总是面临北部,南部,西部和东部。铁轨是在南部,北部和西部,东部方向。该机器人可以移动的方向只有在它的面孔。方向它所面临的可在每一条赛道改变。最初的机器人站在十字路口的轨道。在商店的障碍,形成了从占用地面1米× 1米件。每一个障碍是铁轨内成立了一个1 × 1平方米。机器人的运动控制的两个命令。这些命令GO和转机。
   GO命令有一个整数参数n(1,2,3)。在收到该命令的机器人移动的方向面临&ntilde;米。
   TURN命令有一个参数,要么是左或右。在收到该命令的机器人改变其方向的方向由90度的参数说明。
每个命令执行的持续一秒。
   RMI的帮助研究人员编写程序,将在最短的时间内确定在该机器人可以从一个给定的起点移动到指定的目的地。

输入格式:(a3.in)
  输入包括行块。每个块的第一行包含两个整数m≤50和N≤50用一个空格隔开。在接下来的M行有每N个号码一个或一个空格隔开为零。一位代表的障碍和零意味着空广场。 (在轨道之间的平方。)终止块由一个包含4个正整数乙B2素E1 E2类每一个空间,这个词表明了机器人在随后的起点线方向。为b1,b2是坐标北部平方米,其中西南角的机器人被置于(起点)。素E1,E2是正方形的坐标到北,其中西南角的机器人应动议(目的地)。机器人的方向,已经到达了目的地,问题不在于规定。我们使用(行,列)型坐标,即坐标左上角的商店(最西北部平方米)是0,0和右下角(最东南)见方米- 1, &ntilde; - 1。方向是赋予字向北或向西或南部或东部。最后一个块中只有一个与N = 0和m = 0行。

输出格式:(a3.out)
  输出包含一个每个除了在输入最后一个块块线。该行的顺序对应于输入块。该行包含几秒钟,其中机器人可以到达,从起点到目标点的最小数量。如果不存在从起点到目的地的路线将包含-1任何路径。
示例输入:
9 10
0 0 0 0 0 0 1 0 0 0
0 0 0 0 0 0 0 0 1 0
0 0 0 1 0 0 0 0 0 0
0 0 1 0 0 0 0 0 0 0
0 0 0 0 0 0 1 0 0 0
0 0 0 0 0 1 0 0 0 0
0 0 0 1 1 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
1 0 0 0 0 0 0 0 1 0
7 2 2 7南
0 0
示例输出:
12
题目4:北极网络(TOJ1411) - (a4.cpp)
  国防的(免打扰)部门要连接到无线网络北部几个据点。两种不同的通信技术,将在建立网络的使用:每一个哨所将有一个无线电收发器和一些前哨将另外有一个卫星频道。
  一个卫星频道的任何两个据点可以通过卫星进行通信,不论其地理位置。否则,这两个据点可以通过无线电通讯只有当它们之间的距离不超过D的对收发器的功率而定。高功率D,而收益率较高的成本更多。由于采购和维修的考虑,在前哨的收发器必须是相同的,即对D值是对每一个前哨相同。
  你的任务是确定最低的收发器D的要求。必须有至少一个通信路径(直接或间接)之间对每一个前哨。
输入格式:(a4.in)
  在输入的第一行包含N,则测试的个案。每个测试案例的第一行包含1≤硫≤100个,卫星频道数量,和S“磷≤500,数量的前哨。 P线跟随,给予的(x,y)的每公里哨所坐标(坐标为0到10,000之间的整数)。
输出格式:(a4.out)
  对于每个情况下,输出应该由一个单一给予最低D的要求连接的网络线路。输出应指定2小数点。
示例输入:
1
2 4
0 100
0 300
0 600
150 750
示例输出:
212.13
题目5:护卫的农场(TOJ3144) - (a5.cpp)
  农场有许多丘陵农民赖以约翰希望把警卫,确保了宝贵的牛奶安全奶牛。
  他说,有多少警卫,他需要,如果他希望把每一个山顶之一。他作为一个整数矩阵提供了一份地图;矩阵有N(1“&ntilde;≤700)行和M(1”M“700)列。矩阵的每个成员是一个高度H_ij(0≤H_ij≤10000)。帮助他在地图上确定的山头数量。
  阿山顶是一个或多个包围一方的地图或较低(较小)的高度要素的优势完全同等价值的邻接矩阵的元素。两种不同的元素,如果相邻的不同规模的X坐标是不大于1,在他们的Y坐标的差异程度也没有大于1。
输入格式:(a5.in)
*第1行:两个空间分隔的整数:N和M *线路2 .. N +1个:I线1描述了与M空间分隔的整数:H_ij矩阵i行。
输出格式:(a5.out)
*第1行:一个整数,指定山顶数
示例输入:
8 7
4 3 2 2 1 0 1
3 3 3 2 1 0 1
2 2 2 2 1 0 0
2 1 1 1 1 0 0
1 1 0 0 0 1 0
0 0 0 1 1 1 0
0 1 2 2 1 1 0
0 1 1 1 2 1 0
示例输出:
3




不管黑猫白猫抓住老鼠就是好猫~
2009-08-29 11:40
rofor
Rank: 3Rank: 3
等 级:论坛游侠
帖 子:68
专家分:165
注 册:2009-6-12
收藏
得分:9 
给我200元,帮你全做掉。联系我:QQ:1247142440

I'm rofor.
for(;;;);  :-)
RoFoR [AT] YaHoO [DoT] CN
2009-08-29 12:20
wxjeacen
Rank: 7Rank: 7Rank: 7
等 级:禁止访问
帖 子:1291
专家分:628
注 册:2009-3-22
收藏
得分:9 
以下是引用rofor在2009-8-29 12:20的发言:
给我200元,帮你全做掉。联系我:QQ:1247142440

我感觉我骂你一点也没有骂错。
你也就值200块了。

生命不熄,战斗不止.
2009-08-29 12:29
快速回复:英文C语言题目求解决!
数据加载中...
 
   



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

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