B. The Modcrab

Vova is again playing some computer game, now an RPG. In the game Vova's character received a quest: to slay the fearsome monster called Modcrab.

After two hours of playing the game Vova has tracked the monster and analyzed its tactics. The Modcrab has h2 health points and an attack power of a2. Knowing that, Vova has decided to buy a lot of strong healing potions and to prepare for battle.

Vova's character has h1 health points and an attack power of a1. Also he has a large supply of healing potions, each of which increases his current amount of health points by c1 when Vova drinks a potion. All potions are identical to each other. It is guaranteed that c1 > a2.

The battle consists of multiple phases. In the beginning of each phase, Vova can either attack the monster (thus reducing its health by a1) or drink a healing potion (it increases Vova's health by c1; Vova's health can exceed h1). Then, if the battle is not over yet, the Modcrab attacks Vova, reducing his health by a2. The battle ends when Vova's (or Modcrab's) health drops to 0 or lower. It is possible that the battle ends in a middle of a phase after Vova's attack.

Of course, Vova wants to win the fight. But also he wants to do it as fast as possible. So he wants to make up a strategy that will allow him to win the fight after the minimum possible number of phases.

Help Vova to make up a strategy! You may assume that Vova never runs out of healing potions, and that he can always win.

Input
The first line contains three integers h1, a1, c1 (1 ≤ h1, a1 ≤ 100, 2 ≤ c1 ≤ 100) — Vova's health, Vova's attack power and the healing power of a potion.

The second line contains two integers h2, a2 (1 ≤ h2 ≤ 100, 1 ≤ a2 < c1) — the Modcrab's health and his attack power.

Output
In the first line print one integer n denoting the minimum number of phases required to win the battle.

Then print n lines. i-th line must be equal to HEAL if Vova drinks a potion in i-th phase, or STRIKE if he attacks the Modcrab.

The strategy must be valid: Vova's character must not be defeated before slaying the Modcrab, and the monster's health must be 0 or lower after Vova's last action.

If there are multiple optimal solutions, print any of them.

Input

 

Output

STRIKE
HEAL
STRIKE
STRIKE

Input

 

Output

STRIKE
STRIKE

题意:vova要打败一个怪物,vova 的血量h1,攻击力a1,可以无限使用的血瓶c1,可以加c1这么多血,加的血量可以无上限。怪物的血量h2,攻击力a2。

思路:模拟就行。【注意】一开始没考虑,可以一击必杀的那种情况,就是h2怪物血量小于,vova攻击力并且vova血量小于怪物攻击力,其实不用加血的,直接秒杀

AC代码:

 #include<bits/stdc++.h> 

 using namespace std;

 #define int long long
int arr[];
signed main(){
int h1,a1,c1;
int h2,a2;
cin>>h1>>a1>>c1;
cin>>h2>>a2;
if(a1>=h2){
printf("1\nSTRIKE");
return ;
}
int x1=;
int x2=;
if(h2%a1){
x1++;
}
if(h1%a2){
x2++;
}
x1+=h2/a1;
x2+=h1/a2;
if(x2>=x1){
printf("%d\n",x1);
for(int i=;i<x1;i++){
printf("STRIKE\n");
}
return ;
}
int cnt=;
while(){
if((h2-a1<=)){// 【注意】:可以一击必杀的QAQ
arr[cnt++]=;
break;
}
if((h1-a2)<=){
arr[cnt++]=;
h1+=c1;
}else{
h2=h2-a1;
arr[cnt++]=;
if(h2<=){
break;
} }
h1-=a2;
}
printf("%d\n",cnt-);
for(int i=;i<cnt;i++){
if(arr[i]==){
printf("STRIKE\n");
}else{
printf("HEAL\n");
}
}
return ;
}

Educational Codeforces Round 34 (Rated for Div. 2) B题【打怪模拟】的更多相关文章

  1. Educational Codeforces Round 34 (Rated for Div. 2) A B C D

    Educational Codeforces Round 34 (Rated for Div. 2) A Hungry Student Problem 题目链接: http://codeforces. ...

  2. Educational Codeforces Round 34 (Rated for Div. 2) D - Almost Difference(高精度)

    D. Almost Difference Let's denote a function You are given an array a consisting of n integers. You ...

  3. Educational Codeforces Round 34 (Rated for Div. 2) C. Boxes Packing

    C. Boxes Packing time limit per test 1 second memory limit per test 256 megabytes input standard inp ...

  4. Educational Codeforces Round 34 (Rated for Div. 2)

    A. Hungry Student Problem time limit per test 1 second memory limit per test 256 megabytes input sta ...

  5. Educational Codeforces Round 78 (Rated for Div. 2) --补题

    链接 直接用数组记录每个字母的个数即可 #include<bits/stdc++.h> using namespace std; int a[26] = {0}; int b[26] = ...

  6. Educational Codeforces Round 76 (Rated for Div. 2) D题

    题意: 给你n个关卡,每个关卡有一个怪物,怪物的攻击力为a[i],你有n个英雄,每个英雄有一个攻击力,和疲劳值,只要英雄的攻击力比怪物的高就算打过了,同时疲劳减一,一天只能出战一个英雄,一个英雄可以打 ...

  7. Educational Codeforces Round 67 (Rated for Div. 2) B题【前缀+二分】【补题ING系列】

    题意:给出一个字符串s, 可以从左往右拿走s的字符, 至少要到s的第几个位置才能拼成t 思路:用二维数组记录前缀,然后二分即可. #include<bits/stdc++.h> using ...

  8. Educational Codeforces Round 72 (Rated for Div. 2) C题

    C. The Number Of Good Substrings Problem Description: You are given a binary string s (recall that a ...

  9. Educational Codeforces Round 72 (Rated for Div. 2) B题

    Problem Description: You are fighting with Zmei Gorynich — a ferocious monster from Slavic myths, a ...

随机推荐

  1. 【AtCoder】AGC001

    AGC001 A - BBQ Easy 从第\(2n - 1\)个隔一个加一下加到1即可 #include <bits/stdc++.h> #define fi first #define ...

  2. HttpServletRequest对象(转)

    HttpServletRequest介绍 HttpServletRequest对象代表客户端的请求,当客户端通过HTTP协议访问服务器时,HTTP请求头中的所有信息都封装在这个对象中,通过这个对象提供 ...

  3. Kubernetes---Service(SVC)服务--ingress api

    对于k8s传统的svc来说 它仅支持4层代理,如果遇到7层代理的话,是没有办法去实现的 k8s官方在1.11中推出了ingress api接口,通过ingress达到7层代理的效果 对于ingress ...

  4. 【2019NOIP复习计划】

    (其实不应该这么叫的,应该是CSP-S了现在..) 重点关注的板子: 不知道为什么特别受出题人青睐的LCA(板子点这里) 配套练习:(紫题请自便)  (这题蓝的应该可以试试)  (对的这题也紫它还是道 ...

  5. Equations HDU - 1496(哈希的应用)

    Problem Description Consider equations having the following form: a*x1^2+b*x2^2+c*x3^2+d*x4^2=0 a, b ...

  6. Spring、SpringMVC版本及配置

    一.Spring版本 Spring的最新版本是Spring 5.x,Spring 4.x的最后版本是Spring 4.3.x,会维护到2020年(Spring的GitHub主页对此有说明). 二.Sp ...

  7. Java门面模式(思维导图)

    图1 门面模式[点击查看图片] 1,实体对象类 package com.cnblogs.mufasa.demo1; //3个子系统,解决问题的实体 public class StoreA { //示意 ...

  8. 判断ubuntu是32位还是64位

    在终端输入 sudo uname -m 显示 如果显示i686,你安装了32位操作系统 如果显示 x86_64,你安装了64位操作系统 更多: sudo uname -s 显示内核名字s sudo u ...

  9. 垃圾分类,javascript和python

    首先,实现的步骤,首先在微信applet中设计一个简单的界面,开始映射到python服务器.有关具体界面,请参阅微信小程序设计指南.以下主要讨论后台服务器交互和处理点. 1.使用js将图像上传到pyt ...

  10. iphone SprintBoard部分私有API总结(不支持iOS8)

    本文介绍iOS SrpintBoard框架的部分私有API,具体包括: 获取ios上当前正在运行的所有App的bundle id(不管当前程序是在前台还是后台都可以) 获取ios上当前前台运行的App ...