POJ1806
DescriptionBackground Manhattan in the year 2025 - it is so densely populated that its old two-dimensional grid of streetsand avenues fails to provide enough space for all the traditional vehicles such as cars, bicycles, orbusses.Accordingly, the newly developed 3D-Skyjetters become very popular, because they allow to passthe traffic jams on the ground by flying in the air. After a series of horrible accidents caused by 3D-Skyjetters cutting a corner, New York authorities have put into place new regulations of air traffic and are determined to enforce them rigorously. The key point of these regulations is that 3D-Skyjettersmust follow virtual airways on a three-dimensional rectangular grid, easy enough for the New Yorkers who had to use the two-dimensional rectangular grid of roads on the ground all their life. Problem You own a company that rents out 3D-Skyjetters. As 3D-Skyjetters are in such an early state of development,they are far from being economical. So your customers keep running out of petrol at all the wrong places,and you need a system to inform them about their current range at all times. You may assume that travelling from one intersection to the next in the grid takes one unit of petrol, no matter if the customer is moving horizontally or vertically, up or down. You may also assume that your customer is located at some intersection where his or her movements are not restricted by the ground or other obstacles, but just by the amount of remaining petrol. Given the amount of petrol, provide a graphical representation of all the intersections in the range of your customer, along with the amount of petrol that is needed to go there.Input
The first line of the input contains the number of scenarios. For each scenario, there is a line containing the units of remaining petrol, i.e an integer u satisfying 0 <= u <= 9. If more than 9 units of petrol remain, the customer will ignore the display anyway.OutputStart the output for each scenario with a line containing "Scenario #i:", where i is the number of the scenario
starting at 1. Then print a graphical (or rather textual) representation of all intersections that can be reached with the given amount of petrol, along with the units of petrol necessary to go there. In this graphical representation, print the slices of the smallest axis-aligned three-dimensional cube containing all the intersections in the range, and label the slices from the bottom to the top starting at 1. For each slice,start the output with a line containing "slice #s:", where s is the number of the slice. In the lines that follow, print a graphical representation of all the intersections in that slice, usingthe digits 0 to 9 for intersections in the range, representing the amount of petrol necessary to go there,
and the dot "." for intersections not in the range.
Print an additional blank line after each scenario.
Sample Input2 0 2 Sample OutputScenario #1:
slice #1:0Scenario #2:
slice #1:............2............slice #2:.......2...212...2.......slice #3:..2...212.21012.212...2..slice #4:.......2...212...2.......slice #5:............2............曼哈顿 2025
描述背景曼哈顿2025年的时候,由于人口众多导致它二维的街道不能为所有的传统交通工具提供足够的空间,比如汽车,摩托车,巴士等等。因此,新发明的三维空路变得流行,因为他们可以通过在空中飞行穿过地上的堵塞的交通。一系列恐怖的交通事故之后,纽约当局发布了新的空中交通条款并强制执行。规则的关键点在于3d空中摩托必须沿着3维空间矩形网格的虚拟路线行进,这对于习惯了周围生活中二维矩形网格路的纽约人就容易多了。问题你有一家公司出租3D飞行器。因为3D飞行器在开发的初期,他们并不经济。所以你的客户经常在很多错误的地点消耗完汽油,你需要一个系统来一直提醒他们他们当前的范围。你可以假设从一个交叉点到网格中的下一个点需要1个单位的汽油,无论客户是水平走、垂直走、向上走、向下走。你还可以假设你的客户在某个交叉点,在那个交叉点,它的行动不被地面或者其他障碍所限制,但是受限于剩余的汽油。给一定数量的汽油,提供给你的客户所能到达范围的全部交点的简图以及到达该点需要的汽油数量。输入输入的第一行包括场景的数量。每一个场景,有一行数据表示剩余的汽油数量,比如整型u满足0-9.如果汽油数量多余9,客户可以忽视显示屏的提示信息。输出每个场景的输出第一行是"Scenario #i:",其中i是场景号,从1开始计算。然后打印一个图形化显示的可以用剩余数量的汽油到达的全部交叉点以及到达那里需要的汽油数,在这个图形显示中,打印最小层对称的三维立方体包括范围内的所有焦点,还有为层贴标签从底到顶,从1开始。每一层,以输出"slice #s:"开始,s是层的序号。在接下来的几行,将该层中全部交点以以图的形式表示出来,用数字0-9表示焦点的范围,表示到达该点需要的汽油数。点‘.’表示不在范围内的交点。每一个场景之后输出一个额外的空行。输入例子:2//场景个数0//还剩0个汽油2//还剩2个汽油输出例子:Scenario #1:slice #1:0Scenario #2:
slice #1:............2............slice #2:.......2...212...2.......slice #3:..2...212.21012.212...2..slice #4:.......2...212...2.......slice #5:............2............Problem: | User: | |
Memory: 168K | Time: 32MS | |
Language: C | Result: Accepted |
#include#include #include int Scenario,Oil,Slice,M[30][30];void Display(){ int i,j; for (i=0;i