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. 第9周cf刷题(dp)

    Problems(1300-1600) an ac a day keeps the doctor away Gas Pipeline (1500) 2019.10.28 题意: 管道工人需要在一段凹凸 ...

  2. 为什么我们需要Pod?(容器设计模式sidecar)

    Pod,是 Kubernetes 项目中最小的 API 对象 容器的本质是进程,就是未来云计算系统中的进程:容器镜像就是这个系统里的".exe"安装包 Kubernetes 就是操 ...

  3. Ubuntu 安装 QtCreator (version : Qt 5.9.8)

    平台 :Ubuntu 16.04 QT         :5.9.8 (open source)     首先去QT安装包下载安装包,为了保持与arm板子的统一,本人选择了 5.9.8 版本的QT 可 ...

  4. varnish HTTP头

    Cache-Control:指定了缓存如何处理内容.varnish关心max-age参数,并用它来计算对象的TTL.“Cache-Control:no-cache”是被忽略的.Age:varnish添 ...

  5. poj 3468 整理一下线段树的写法

    // 对于延迟更新,我们在updata 和query的时候 pushdown和pushup两个东西都要存在 #include <iostream> #include <cstdio& ...

  6. SQL游标示例

    DECLARE @@totalNum INT;SET @@totalNum=0;DECLARE @num INT;DECLARE @CustomInfo NVARCHAR(MAX);DECLARE M ...

  7. 6. Java基本数据类型

    Java 基本数据类型 变量就是申请内存来存储值.也就是说,当创建变量的时候,需要在内存中申请空间. 内存管理系统根据变量的类型为变量分配存储空间,分配的空间只能用来储存该类型数据. 因此,通过定义不 ...

  8. SpringBoot项目的限流

    开发访问量比较大的系统是,爬虫的目的就是解决访问量大的问题:缓存穿透是为了保护后端数据库查询服务:计数服务解决了接近真实访问量以及数据库服务的压力. 架构图 限流 就拿十万博客来说,如果存在热点文章, ...

  9. php 如何将image图片转化为字符串(GD库操作及imagick两种实现方式)

    前两天研究php中的 imagick 扩展的时候,突发奇想实现的一个小功能感觉挺有意思,在这里记录一下: 将一张image图片转化为字符串的形式,先上一张效果图.(运行笔记中的代码需要先安装 php_ ...

  10. JS 发送弹幕

    JS实现弹幕的发送 <div class="box1"> <div class="box2" style="width: 600px ...