编程介的小学生 2019-06-18 20:04 采纳率: 20.5%
浏览 236

计算反射的角度的问题的一个算法,怎么用C语言的程序的设计的技术怎么用代码实现的

Problem Description
As a ninja, Saito Hajime has to fight many opponents who are foolish enough to challenge his might. Most of these opponents fall easily to Saito's great martial arts techniques and ninjitsus(A ninjitsu is a technique that comes from the ninjas inner power called Qi.). From time to time however, the great Saito Hajime has to take care of a particularly powerful and skilled foe(In the age of ninjas, such a foe was commonly referred to as Boss.). This foe usually enters the combat after several dozens of his/her minions have been defeated by Saito. Saito always encounters such foes in empty rectangular rooms.

In order to defeat such a powerful foe, Saito has to perform a special ninjitsu known as Saito Hajime's Zero Stance Ultimate Finishing Strike. This strike involves hitting his foe by performing a flying kick that starts at Saito's current position. Of course, a simple flying kick will not be enough to defeat a powerful foe, but Saito can improve the power of his strike by bouncing off several walls before hitting his foe. Every bounce gives his attack more power, so that with enough bounces any foe can be defeated. Note that Saito always bounces off a wall according to the rule \angle of incidence is equal to the angle of reflection".
Saito knows how often he has to bounce off a wall to defeat a particular foe. He must be careful though,if his attack takes too long, his foe might be able to dodge his attack. Therefore, the distance traveled by Saito while performing his strike must be as short as possible. Can you figure out how often Saito will hit each of the four walls while performing his strike?

Input
The first line of the input contains a single number: the number of test cases to follow. Each test case has the following format:
1.A line with three positive integer numbers L,W (3 <= L;W <= 100), and B (0 <= B <= 10^5): the length and width of the room, and the number of bounces necessary to defeat his foe.
2.A line with two positive integer numbers xf (0 < xf < L) and yf (0 < yf < W): the starting coordinates of Saito.
3.A line with two positive integer numbers xf (0 < xf < L) and yf (0 < yf < W): the coordinates of the foe.
The bottom left corner of the room is at (0, 0). You can assume that Saito and his foe do not start at the same position. If Saito hits a corner of the room, this counts as two bounces, one for each wall. Also, Saito is able to fly over his foe while performing his strike.

Output
For every test case in the input, the output should contain:
1.One line with four integers: the number of times Saito has hit the north, east, south, and west wall, respectively. The north wall is in the positive y-direction and the east wall is in the positive x-direction. In case there are multiple possibilities, you must output all of them ordered lexicographically, each on a separate line.
2.One line containing the number 0.

Sample Input
2
3 3 1
1 1
2 2
6 6 3
3 1
2 4

Sample Output
0 0 0 1
0 0 1 0
0 1 0 0
1 0 0 0
0
1 0 1 1
0

  • 写回答

0条回答

    报告相同问题?

    悬赏问题

    • ¥50 导入文件到网吧的电脑并且在重启之后不会被恢复
    • ¥15 (希望可以解决问题)ma和mb文件无法正常打开,打开后是空白,但是有正常内存占用,但可以在打开Maya应用程序后打开场景ma和mb格式。
    • ¥15 绘制多分类任务的roc曲线时只画出了一类的roc,其它的auc显示为nan
    • ¥20 ML307A在使用AT命令连接EMQX平台的MQTT时被拒绝
    • ¥20 腾讯企业邮箱邮件可以恢复么
    • ¥15 有人知道怎么将自己的迁移策略布到edgecloudsim上使用吗?
    • ¥15 错误 LNK2001 无法解析的外部符号
    • ¥50 安装pyaudiokits失败
    • ¥15 计组这些题应该咋做呀
    • ¥60 更换迈创SOL6M4AE卡的时候,驱动要重新装才能使用,怎么解决?