StarCraft II Battle problem

Source: Internet
Author: User

Question Description

Two springtails are fighting the Marines. Initially, the Marines found Springtails (two springtails side-by springtails) at a certain distance from him and started attacking (only one). When the springtails is 0 o'clock from the Marines, the attack is also launched. Suppose springtails a time unit to walk one meter, or every attack once. Marines attack once per unit of time. The last question was whether the Marines won or the Springtails won.

VS

Input
Five integers, n (n <=), K (5 <= K <= 8), L (5 <= L <= 8), M (1 <= m <=), X (1 <= x <= 45).
These numbers mean that the Marines found the enemy's distance, springtails attack damage, Marines ' attack, each springtails initial blood volume, and the last number was the first blood of the Marines.
Output
Output Marine win! or zergling win!
Marines win when the output marine win!
Springtails win-time output zergling win!
Input example
11 6 5) 45 35
Output example
Zergling win!
Other Notes
Note that there is finally a line change!

C + + programs:

#include <iostream>using namespacestd;intMain () {intN; intK; intm; intl; intx; CIN>> n >> k >> l >> m >>x; intMarine =x; intZERG1 =m; intZERG2 =m; intDistance =N;  while(Marine >0&& (Zerg1 >0|| Zerg2 >0))         {            if(Distance && zerg1 >0) {Distance--; Zerg1-=l; } Else if(Distance && zerg1 <=0&& zerg2 >0) {Distance--; Zerg2-=l; }Else if(Zerg1 >0) {Zerg1-=l; Marine-= k *2; } Else{zerg2-=l; Marine-=K; }        }            if(Marine >0) cout <<"Marine win!"<<Endl; Elsecout <<"zergling win!"<<Endl; return 0;}

StarCraft II Battle problem

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.