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. LeetCode 第 167 场周赛

    1290.二进制链表转整数 1291.顺次数 1292.元素和小于等于阈值的正方形的最大边长 1293.网格中的最短路径 1290.二进制链表转整数 1290.二进制链表转整数 给你一个单链表的引用结 ...

  2. 关于MD5加盐使用

    md5 是一种数据加密,例子是对123456 进行了两次加盐 第一次是 inputPassToFormPass   salt是固定的 1a2b3c4d 第二次是  formPassToDBPass s ...

  3. Java--垃圾回收【转载】

    一:垃圾回收机制的意义 java 语言中一个显著的特点就是引入了java回收机制,可以有效的防止内存泄露,有效的使用空闲的内存. 内存泄露:指该内存空间使用完毕后未回收,在不涉及复杂数据结构的一般情况 ...

  4. 南昌网络赛J. Distance on the tree 树链剖分

    Distance on the tree 题目链接 https://nanti.jisuanke.com/t/38229 Describe DSM(Data Structure Master) onc ...

  5. django的admin密码忘记了怎么办?一分钟解决!!

    django-admin确实是在实际开发中很方便,然后项目开发一段时间放到一边,等你再去玩你当初的项目的时候,可能抱歉你的admin密码忘记了,其实解决办法有很多种,我直说最快的一种,直接重新建立一个 ...

  6. S02_CH09_UART串口中断实验

    S02_CH09_UART串口中断实验 本章的UART中断将在之前PL_PS中断和定时器中断上推导出来,因此本章有点难度,如果前两章还不是很熟悉的话,需要返回到前面两章把这两章的内容再次消化一下,再来 ...

  7. vue之多页面的开发

    我们平常用vue开发的时候总觉得vue好像就是专门为了单页面应用而诞生的,其实不是.因为vue在工程化开发的时候很依赖webpack,而webpack是将所有的资源整合到一块,弄成一个单页面.但是vu ...

  8. configure,make和make install关系

    linux编译安装中configure.make和make install各自的作用 ./configure是用来检测你的安装平台的目标特征的.configure根据给定的参数和系统环境会生成Make ...

  9. Java装饰者模式(思维导图)

    图1 装饰者模式[点击查看图片] 1,一个简单的以人为主体的装饰者模式 被装饰者 public interface Human {//被装饰者 public void wearClothes(); p ...

  10. SQL Prompt 注册后隔一段时间莫名无法使用的处理

    https://blog.csdn.net/anyqu/article/details/88537197 以前一直以为是授权丢了,反复重装也解决不了 Sql Prompt---Unable to co ...