编程介的小学生 2019-04-17 13:39 采纳率: 20.5%
浏览 158

二字符数组的匹配判断的算法,利用C语言的程序的设计的原则的计算方式

Problem Description
Magina is surround by hundreds of monsters. Can he survive in T unit times?
Now matter Magina or monster have three attributes(ATI, DEF, HP), but Magina have another attributes (MaxHP). Magina can own some equipments as a hero , there are six kinds of equipment ("Head", "Weapon", "Armor","Shoes", "Trump","Cuff") in this world. Equipment have three attributes (A, D, MH), each standing the value can increase to ATI, DEF and MaxHP of Magina.
To every some kinds of equipment, Magina can only choose one to use. So when he have some kinds of equipments, he will choose the one have the bigger value. The value of equipments define as A*3 + D*2 + MH. If the value of equipments is equal to the one Magina have, he will not choose to change his equipment.

Now describe a fighting between A and B.
We know A hurt B first, the value of harm define as P.
P = MAX(1,(int)((A's ATI - B's DEF) / ( abs(Xa-Xb) + abs(Ya-Yb) + 1))). (Xa,Ya) and (Xb,Yb) is the position of A and B. So B's HP will reduce P.
Than B hurt A. A will loss MAX(1,(int)((B's ATI - A's DEF) / ( abs(Xa-Xb) + abs(Ya-Yb) + 1))).
Every one will die if his HP is small or equal to 0.

In the 2d-world. Magina standing in the position (0,0) and never moving, in T unit time, n monsters will move nearly to attack he. To every unit time we divide it to four processes.
First Magina choose K monsters to attack once each continuously .(He will attack all if there are no K monsters survived ) If a monster die by attacking, he will drop a equipment. Than Magina can choose weather to use it. The way Magina choose is according to the P which is the value of his hurting to the monster. The first K higher monsters will be selected at the every unit time's begining, if two monsters have some P, the smaller ID of monsters will be selected.
Second every monster survived will hurt Magina once continuously. If Magina die, game over.

Third every monster survived will move to Magina one unit. If the monster is standing the place of Magina, he will not move. One unit is meaning X or Y to change only one.

Fourth Magina will revert W HP. W = (int) ( MaxHP*0.05 ). The maximum of HP can not bigger than MaxHP.

Input
The input contains multiple test cases.
First line give the integer n (1<= n <=400)
Next line ATI, DEF, MaxHP,K,T. (T<=100). Magina is HP = MaxHP and have no equipment at the begin.
Next follow n line, each line expressing a monster by increasint ID.The input form as ATI, DEF,HP,X,Y, Kind'smane, A, D, MH. All integer are nonnegative.Last four expressing the equipment this monster owned.Kind'smane is the kind name of equipment.It can only be one of six describing foregoing

Output
Output the information of Magina's equipment during the T unit times.
If Magina use a equipment when he have no this kind of equipment, Output “Magina get the Sname”.
If Magina use a new well equipment, output"Magina update the Sname", Sname is the kind name of six equipments.
Last Output "Magina death !" if Magina is death .Otherwise output "Magina killed Num Monster!",Num is a numbers of monsters Magina killed during T unit times.
Every case follow a blank.

Sample Input
1
30 2 100 1 3
3 0 10 2 2 Head 1 0 0

5
192 114 29 3 64
22 3 140 15 5 Head 32 18 4
45 15 114 4 11 Trump 34 47 48
44 9 186 19 2 Cuff 28 46 12
32 3 2 10 18 Armor 45 40 15
27 3 104 1 3 Trump 37 2 22

5
30 130 33 2 85
34 4 163 13 15 Head 32 9 15
11 3 8 3 12 Cuff 7 22 4
11 14 143 3 18 Weapon 48 17 35
5 14 27 10 1 Cuff 9 25 41
34 17 135 13 1 Weapon 48 0 33

Sample Output
Magina get the Head
Magina killed 1 Monster!

Magina get the Trump
Magina update the Trump
Magina get the Armor
Magina get the Head
Magina get the Cuff
Magina killed 5 Monster!

Magina get the Cuff
Magina death !

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 求帮我调试一下freefem代码
    • ¥15 R语言Rstudio突然无法启动
    • ¥15 关于#matlab#的问题:提取2个图像的变量作为另外一个图像像元的移动量,计算新的位置创建新的图像并提取第二个图像的变量到新的图像
    • ¥15 改算法,照着压缩包里边,参考其他代码封装的格式 写到main函数里
    • ¥15 用windows做服务的同志有吗
    • ¥60 求一个简单的网页(标签-安全|关键词-上传)
    • ¥35 lstm时间序列共享单车预测,loss值优化,参数优化算法
    • ¥15 Python中的request,如何使用ssr节点,通过代理requests网页。本人在泰国,需要用大陆ip才能玩网页游戏,合法合规。
    • ¥100 为什么这个恒流源电路不能恒流?
    • ¥15 有偿求跨组件数据流路径图