编程介的小学生 2019-08-20 21:50 采纳率: 20.5%
浏览 125

程序设计,Worms问题的解释

Problem Description
Worms is a series of turn-based computer games. Players control a small platoon of earthworms across a deformable landscape, battling other computer- or player-controlled teams. The game feature bright and humorous cartoon-style animation and a varied arsenal of bizarre weapons.

During the course of the game, players take turns selecting one of their worms. They then use whatever tools and weapons available to attack and kill the opponents’ worms. Over fifty weapons and tools may be available each time a game is played, and differing selections of weapons and tools can be saved into a “scheme” for easy selection in future games.

When most weapons are used, they cause explosions that deform the terrain, creating circular cavities. If a worm is hit by a weapon, the amount of damage dealt to the worm will be removed from the worm’s initial amount of health. When a worm fall into the water or its health is reduced to zero, it dies.

In this problem, the terrain of a stone can be described as a simple polygon. The worms only use the time bombs. Once a time bomb is thrown, it is only attracted by the force of gravity. In other words, the flying track of the bomb is a parabola. When it reaches the stone (the polygon), the bomb does not blow off or stop immediately. It will still fly along the parabola regardless of the resistance of the stone due to its special character. The time bomb can only be triggered by the timer. When the preset time is used up, the bomb blows up and eliminates all the materials within its explosion range. You need to calculate the area of the eliminated materials of one explosion.

Input
There are multiple test cases.
The first line of a test case contains seven floating numbers x0, y0, v0, θ, t, g, R. (x0, y0) is the position of the worm who throws the bomb, which could be inside the polygon or outside the polygon (even in the sky or under the water). The initial value of velocity is v0 which forms aθ (0≤θ<90) angle with the positive direction of x-axis. The bomb is always thrown upwards. The preset time is t, which is also the time of flying. The value of acceleration of gravity of the worms’ planet is g. The direction of gravity is the negative direction of y-axis. The explosion range is a circle and R is the radius.

The second line contains an integer n (3≤n≤100), which indicates the number of edges of the stone(simple polygon). The following n lines contain two real numbers xi and yi each, which describe the coordinates of a vertex. Two vertexes in adjacent lines are adjacent on the polygon.

The input contains multiple test cases. It is ended by “0 0 0 0 0 0 0”.

Output
For each test case, output one line containing the area of the eliminated materials of the explosion rounded to two digits to the right of the decimal point.

Sample Input
0 0 15 45 10 2 10
3
100 0
200 0
100 100
0 0 0 0 0 0 0

Sample Output
228.74

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥20 fluent无法启动
    • ¥15 孟德尔随机化r语言运行问题
    • ¥15 pyinstaller编译的时候出现No module named 'imp'
    • ¥15 nirs_kit中打码怎么看(打码文件是csv格式)
    • ¥15 怎么把多于硬盘空间放到根目录下
    • ¥15 Matlab问题解答有两个问题
    • ¥15 LCD12864中文显示
    • ¥15 在使用CH341SER.EXE时不小心把所有驱动文件删除了怎么解决
    • ¥15 gsoap生成onvif框架
    • ¥15 有关sql server business intellige安装,包括SSDT、SSMS。