HBC205092Hinnjaku题解

你曾走过我的故事 算法基础篇 52 0
想要成为编程高手?那就来试试全网最全C++题库,让您在练习中快速成长。
"I learned one thing from my short life that the ability of human-being is limited. The more one digs into strategy, the more possibly he would realize this point. Therefore, I won't be a human-being anymore, JOJO!

"I learned one thing from my short life that the ability of human-being is limited. The more one digs into strategy, the more possibly he would realize this point. Therefore, I won't be a human-being anymore, JOJO!" During the outbreak of the COVID-19, HamsterW was bored at home after reading the manga drawn by E Yu, therefore he pick up an interesting bangumi named JOJO's Wonderful Adventure: Now the bangumi comes to the most thrilling part: the battle between JOJO and Dio. The rule of their battle is as follows: In the initial state, JOJO and Dio both have a equal health point represented by HHH. Whose HP returns to zero first is regarded as the defeated one. And if the duel is completed and no one has the zero HP, the one who has more HP will win the duel. Because their attacks are through their special abilities named stand and normal people are not able to see them, here we will represent JOJO and Dio's attacks as two strings sss,ttt. the length of the two stings is equal to NNN, which is the seconds their battle lasts. The strings will only contain lower case characters 'a', 'd','l', 'm', 'o', 'r', 'u', 'w', 'z'. Every character in the string stands an action their stands make, and the i−thi-thi−th character is the action of the i−thi-thi−th second. Fighting time goes by with the appearance of characters. Every time when last three letters form a string "ora" in JOJO's string, JOJO's stand named Star Platinum finish an attack and Dio's HP decreases by one point. Meanwhile, when last four letters form a string "muda" in Dio's string, it means that DIO's stand named The World makes an attack, causing JOJO's HP decreases by one point. Apart from normal attacks, they also have the superpower called "zawaluduo" which can pause the time. When one side uses "zawaluduo", the other side will pause attack (i.e. The attack will be interrupted and won't take effect). If zawaluduo appears in one's string, it means that he triggers this ability at the time letter o represents for. Since "ora" is shorter than "muda", Dio is obviously at a disadvantage. But Dio's superpower is stronger than JOJO. If JOJO uses the "zawaluduo", it will have a killing effect on Dio, and Dio's HP will turn to zero. If Dio uses this ability, it will also have a killing effect on JOJO, and JOJO's HP will turn to zero. Since JOJO's superpower is weaker than Dio, if JOJO and Dio use this superpower at the same time, it will be judged that Dio will try the superpower first and therefore JOJO is killed at once. Finally, according to the strings representing their battle, you need to anticipate the result. If JOJO wins, you need to output "Wryyyyy". If Dio wins, you need to output "Hinnjaku". If there is a tie, you need to output "Kono Dio da". (This means their HP decreases to zero at the same time, or they have equal HP which is greater than zero after the duel.)

HBC205092Hinnjaku题解
-第1张图片-东莞河马信息技术
(图片来源网络,侵删)
想要在职场中立于不败之地?那就来试试全网最全C++题库,让您在练习中快速提升技能。

标签: HBC205092Hinnjaku题解