B. The Modcrab
time limit per test

1 second

memory limit per test

256 megabytes

input

standard input

output

standard output

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 bya1) 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.

Examples
input
10 6 100
17 5
output
4
STRIKE
HEAL
STRIKE
STRIKE
input
11 6 100
12 5
output
2
STRIKE
STRIKE
Note

In the first example Vova's character must heal before or after his first attack. Otherwise his health will drop to zero in 2 phases while he needs 3 strikes to win.

In the second example no healing needed, two strikes are enough to get monster to zero health and win with 6 health left.

【分析】:STL还是用的太少了···C++还要再学一波

【代码】:

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define oo 10000000
const int mod = 1e6; int main()
{
vector<string> v;
int a1,b1,h1;
int a2,b2;
int j=;
int f[];
scanf("%d%d%d",&a1,&b1,&h1);
scanf("%d%d",&a2,&b2);
while()
{
if(b1>=a2) //一击必杀就跳出···因为怪兽你已经死了
{
v.push_back("STRIKE");
break;
}
else
{
if(a1<=b2)
{
a1 += h1; //补血
a1 -= b2; //补完还是要被打 怪兽不会等你补就不打了
v.push_back("HEAL");
}
else
{
a1 -= b2; //我的血少了
a2 -= b1; //怪兽的血少了
v.push_back("STRIKE");
}
}
}
printf("%d\n",(int)v.size()); for(auto &i:v)
{
printf("%s\n",i.c_str());
}
return ;
}

Educational Codeforces Round 34 B. The Modcrab【模拟/STL】的更多相关文章

  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) B题【打怪模拟】

    B. The Modcrab Vova is again playing some computer game, now an RPG. In the game Vova's character re ...

  3. Educational Codeforces Round 34 D. Almost Difference【模拟/stl-map/ long double】

    D. Almost Difference time limit per test 2 seconds memory limit per test 256 megabytes input standar ...

  4. Educational Codeforces Round 34 C. Boxes Packing【模拟/STL-map/俄罗斯套娃】

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

  5. Educational Codeforces Round 2 A. Extract Numbers 模拟题

    A. Extract Numbers Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/600/pr ...

  6. Educational Codeforces Round 11B. Seating On Bus 模拟

    地址:http://codeforces.com/contest/660/problem/B 题目: B. Seating On Bus time limit per test 1 second me ...

  7. 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 ...

  8. Educational Codeforces Round 34

    F - Clear The Matrix 分析 题目问将所有星变成点的花费,限制了行数(只有4行),就可以往状压DP上去靠了. \(dp[i][j]\) 表示到第 \(i\) 列时状态为 \(j\) ...

  9. 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 ...

随机推荐

  1. GBDT算法简述

    提升决策树GBDT 梯度提升决策树算法是近年来被提及较多的一个算法,这主要得益于其算法的性能,以及该算法在各类数据挖掘以及机器学习比赛中的卓越表现,有很多人对GBDT算法进行了开源代码的开发,比较火的 ...

  2. Python基础-week01 Python安装/变量/输入/及循环语句使用

      一.Python介绍 (1).目前Python主要应用领域: 云计算: 云计算最火的语言, 典型应用OpenStack WEB开发: 众多优秀的WEB框架,众多大型网站均为Python开发,You ...

  3. 看似不是dfs的dfs HDU-1455

    Sticks Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Subm ...

  4. Postgresql 查看建表语句 命令

    pg_dump -U username databasename -W -s -t tablename -s, --schema-only 只转储模式, 不包括数据 -t, --table=TABLE ...

  5. PAT1031

    一个合法的身份证号码由17位地区.日期编号和顺序编号加1位校验码组成.校验码的计算规则如下: 首先对前17位数字加权求和,权重分配为:{7,9,10,5,8,4,2,1,6,3,7,9,10,5,8, ...

  6. C#中var、int、object性能比较(已修正)

    var关键字是.net3.5推出的关键字,主要是让编译器自动推断并判断变量类型,类似javascript中的var. 在使用一些性能优化软件时,在代码优化时,我发现不管定义什么类型的变量,变量的类型都 ...

  7. Codeforces Round #418 (Div. 2) A+B+C!

    终判才知道自己失了智.本场据说是chinese专场,可是请允许我吐槽一下题意! A. An abandoned sentiment from past shabi贪心手残for循环边界写错了竟然还过了 ...

  8. BZOJ3571 [Hnoi2014]画框 【分治 + KM算法】

    题目链接 BZOJ3571 题解 如果知道最小乘积生成树,那么这种双权值乘积最小就是裸题了 将两权值和作为坐标,转化为二维坐标系下凸包上的点,然后不断划分分治就好了 这里求的是最小匹配值,每次找点套一 ...

  9. BZOJ2395 [Balkan 2011]Timeismoney 【最小乘积生成树】

    题目链接 BZOJ2395 题意:无向图中每条边有两种权值,定义一个生成树的权值为两种权值各自的和的积 求权值最小的生成树 题解 如果我们将一个生成树的权值看做坐标,那么每一个生成树就对应一个二维平面 ...

  10. iOS指向函数的指针和block

      一:block基础知识 block基础知识 基本概念:block是用来保存一段代码的:^:是block得标志  好比*:是指针的标志 特点:1:保存一段代码: 2:可以有参数和返回值: 3:可以作 ...