博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
POJ1806 Manhattan 2025
阅读量:5942 次
发布时间:2019-06-19

本文共 4452 字,大约阅读时间需要 14 分钟。

POJ1806

Description
Background
Manhattan in the year 2025 - it is so densely populated that its old two-dimensional grid of streets
and avenues fails to provide enough space for all the traditional vehicles such as cars, bicycles, or
busses.Accordingly, the newly developed 3D-Skyjetters become very popular, because they allow to pass
the 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-Skyjetters
must 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.
Output

Start 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, using

the 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 Input
2
0
2
Sample Output

Scenario #1:

slice #1:
0

Scenario #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:
0

Scenario #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

 

 

转载地址:http://ukqtx.baihongyu.com/

你可能感兴趣的文章
iis6 zencart1.39 伪静态规则
查看>>
SQL Server代理(3/12):代理警报和操作员
查看>>
基于事件驱动的DDD领域驱动设计框架分享(附源代码)
查看>>
Linux备份ifcfg-eth0文件导致的网络故障问题
查看>>
2018年尾总结——稳中成长
查看>>
JFreeChart开发_用JFreeChart增强JSP报表的用户体验
查看>>
度量时间差
查看>>
apache prefork模式优化错误
查看>>
通过jsp请求Servlet来操作HBASE
查看>>
JS页面刷新保持数据不丢失
查看>>
清橙A1202&Bzoj2201:彩色圆环
查看>>
使用data pump工具的准备
查看>>
springMVC---级联属性
查看>>
get和post区别
查看>>
crontab执行shell脚本日志中出现乱码
查看>>
cmd.exe启动参数说明
查看>>
《随笔记录》20170310
查看>>
网站分析系统
查看>>
从零开始来看一下Java泛型的设计
查看>>
Shell编程基础
查看>>