文章

1

粉丝

76

获赞

1

访问

3.3k

头像
EZ SOLO
P1204
发布于2022年6月6日 17:03
阅读数 3.3k

按题意模拟攻击操作即可

#include <bits/stdc++.h>
using namespace std;

int main() {
	int h1, a1, h2, a2;
	while(scanf("%d%d%d%d", &h1, &a1, &h2, &a2)!=EOF){
		bool firstcase = true;
		while(1) {
			if(firstcase == true) {
				h1 -= a2;
				firstcase = false;
				if(h1 <= 0) {
				printf("GG!\n");
				break;
				}
			}
			else {
				h2 -= a1;
				firstcase = true;
				if(h2 <= 0) {
				printf("WIN!\n");
				break;
				}
			}
		}
	}
	return 0;
} 

 

登录查看完整内容


登录后发布评论

暂无评论,来抢沙发