编程介的小学生 2017-10-05 01:16 采纳率: 20.5%
浏览 782
已采纳

Jetpack Sniper 3000 Fragfest Extreme

Description

You are a beta tester for a new online game, Jetpack Sniper 3000 Fragfest Extreme. In this game, players with jetpacks fly around major metropolitan areas and attempt to shoot each other with laser guns. The only obstacles behind which players can hide are the ever-present glass towers of cubicle farms, skyscrapers.

To assist you in playing the game, you've written a program that will tell you which players could currently shoot (or be shot) by you. These are the players who have an unobstructed view of your position.
Input

Input to this problem will begin with a line containing a single integer n indicating the number of cities in the input. Each city is made of 100 city blocks (10x10), each of which contains a skyscraper of an integer height from 0 to 9. A city is represented in the input as 10 lines of 10 integers, where the integers are the height values of the corresponding skyscrapers. This is followed by one line with four sets of coordinates. The first denotes your position; the other three denote the positions of players A, B, and C, respectively. Positions are given in the format (x, y, height), where x is measured from left to right on the input city grid, y is measured from top to bottom, height is measured from the ground up, and (0,0,0) is at the top left of the input city grid at ground level.

Note:
The coordinates of player positions may contain floating point numbers.
Neither you nor any of the other players will ever be inside a building or on one of its edges or sides. Your line of sight to another player will never be tangent to the side, edge, or corner of a building in such a way that it changes the outcome of the program.
Output

For each city in the input, output the header "Fragfest City #X" where X is 1 for the first city, 2 for the second, etc. Follow this line with one line for each of players A, B, and C and print either "Player Y is in sight" or "Player Y is hiding" depending on whether or not a building obstructs your view of that player.

Please make these two simplifying assumptions:

A skyscraper is a rectangular solid with dimensions 1x1xheight;
a player is the size and shape of a point;
and a player does not block the view of another player.
Sample Input

2
0000005000
0000005000
0000005000
0000005000
9999999999
0000000000
0000000000
0000000000
0000000000
0000000000
(0,0,0) (10, 10, 10) (5.5, 5.5, 5.5) (9, 1.0, 9)
0123456789
1000000000
2064646400
3045555600
4065005400
5045005600
6065555400
7046464600
8000000000
9123456789
(4.5, 4.5, 5.5) (7.5, 4.5, 5.5) (1.5, 4.5, 5.1) (7.5, 4.5, 6.5)

Sample Output

Fragfest City #1
Player A is hiding
Player B is hiding
Player C is in sight
Fragfest City #2
Player A is in sight
Player B is hiding
Player C is in sight

  • 写回答

1条回答 默认 最新

  • threenewbee 2017-10-24 12:44
    关注
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 乘性高斯噪声在深度学习网络中的应用
  • ¥15 运筹学排序问题中的在线排序
  • ¥15 关于docker部署flink集成hadoop的yarn,请教个问题 flink启动yarn-session.sh连不上hadoop,这个整了好几天一直不行,求帮忙看一下怎么解决
  • ¥30 求一段fortran代码用IVF编译运行的结果
  • ¥15 深度学习根据CNN网络模型,搭建BP模型并训练MNIST数据集
  • ¥15 C++ 头文件/宏冲突问题解决
  • ¥15 用comsol模拟大气湍流通过底部加热(温度不同)的腔体
  • ¥50 安卓adb backup备份子用户应用数据失败
  • ¥20 有人能用聚类分析帮我分析一下文本内容嘛
  • ¥30 python代码,帮调试,帮帮忙吧