The Modcrab (简单模拟)

Abaqus数据导出技巧:轻松处理大量XY数据 通过上述三种方法,我们可以解决Abaqus中大量XY数据导出的问题。无论是使用插件、编写Python脚本,还是利用Abaqus的内置报告功能,都可以帮助我们高效地处理数据。希望这篇博客能够帮助到你,提高你在Abaqus使用过程中的数据处理效率。 阅读详情

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.

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.

code:

#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;
int main(){
    int h1,a1,c1;
    int h2,a2;
    cin >> h1 >> a1 >> c1;
    cin >> h2 >> a2;
    int attack = h2 / a1;
    int heal = 0;
    if(attack * a1 < h2) attack++;
    int be_attacked = attack - 1;
    int need = be_attacked * a2 - h1;
    if(need >= 0){
        int add = c1 - a2;
        heal = need / add;
        if(heal * add <= need) heal++;
    }
    printf("%d\n",heal+attack);
    while(heal--){
        printf("HEAL\n");
    }
    while(attack--){
        printf("STRIKE\n");
    }
    return 0;
}


C语言使用开源库libusb进行USB设备操作 https://libusb.info/libusb is a C library that provides generic access to USB devices. It is intended to be used by developers to facilitate the production of applications that communicate with USB hardware. It is portable: Using a single cross-platform AP 阅读详情

相关推荐

【万字长文】学习Armv8架构虚拟化一篇就够了

这里我们将介绍一些基础的Hypervisor和虚拟化的理论知识。如果你已经有一定的基础或是已经熟悉了这些概念,可以跳过这部分内容。我们用Hypervisor这个词来定义一种负责创建,管理以及调度虚拟机(Virtual Machines, VMs)的软件。Stage 2 转换允许Hypervisor控制虚拟机的内存视图。具体来说,其可以控制虚拟机是否可以访问特定的某一块物理内存,以及该内存块出现在虚拟机内存空间的位置。这种能力对于虚拟机的隔离和沙箱功能来说至关重要。

叫好与叫座虽然不是对立面,但想在同一个作品中达到双重效果很难。 5312

CodeForces - 903B 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 ...

codertcm的博客 298

海康视觉平台VisionMaster通讯实战:三种触发方式深度解析

本文深度解析海康视觉平台VisionMaster的三种通讯触发方式:字符串触发、接收字符串事件触发和轮询D地址触发。通过实际案例和配置技巧,帮助工程师在工业场景中实现高效、稳定的设备通讯,提升视觉系统的集成效率和可靠性。

weixin_42665255的博客 280

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 h

qq_62079079的博客 365

DMR对讲机的基本概念理解

刚刚入手DMR对讲机,尚未成功联通。国内互联网上能找到的资料很少,大多数也都是一些DMR协议介绍之类的玩意,对实际操作没有指导意义。以下全部是这几天在网上研究各种资料得出的个人思考,如有错误请斧正。 相比与模拟通讯系统,DMR将语音信号转换为包的形式进行收发。将DMR对比成TCP/IP系统会更容易理解。 一般DMR对讲机都支持模数双通,说明DMR应该使用了跟FM同样的无线AP组件,只在解码上有区别。对讲机先使用DMR进行数字解码,解码成功则说明是数字信号,不成功则使用模拟方式再次进行解码。可以对等理解为

1万+

概述DeepLab系列(deeplab v1, deeplab v2, deeplab v3, deeplab v3+)

前言:图像分割是指像素级别的图像识别,即标注出图像中每个像素所属的对象类别。 语义分割更注重类别之间的区分,而实例分割更注重个体之间的区别。 DeepLab是由Google团队提出的一系列图像分割算法。 DeepLab v1 (2014年) Paper (ICLR 2015) Code 创新点: 空洞卷积(Atrous Conv); <解决编码过程中信号不断被下采样,细节丢失的问题> 全连接条件随机场(Fully-connected Conditional Random Field)。

ZSH12345678900的博客 5528

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

码农的一亩三分地 346

SAP-ABAP:接口多继承与复合接口设计:复杂业务场景下的能力组合实现方案

本文介绍了ABAP中通过接口多继承与复合接口设计实现能力组合的方案。文章首先辨析了类实现多个接口与接口继承接口的核心概念,指出ABAP虽不支持类多继承,但可通过这两种机制灵活组合能力。随后详细讲解了类实现多个接口的语法规则与三种调用方式,并给出了五个基础能力接口的设计示例(日志记录、权限校验、数据导出、消息通知、格式转换)。作者通过对比单继承与接口多重实现的差异,强调后者在解耦和扩展性上的优势,为复杂业务场景下的能力组合提供了实用解决方案。

baidu_35680696的博客 244

The Modcrab_Codeforces

原题链接:http://codeforces.com/contest/903/problem/B B. The Modcrab time limit per test 1 second memory limit per test 256 megabytes input standard input output standard outpu

MoogleAndChocobo的博客 607

一文弄懂Word2Vec之skip-gram(含详细代码)

目录 前言 一、什么是Skip-gram算法 二、目标是什么 三、定义表示法 3.1 one-hot向量 3.2 词向量(word vector) 3.3 单词矩阵 3.4 单词相似度 3.5 softmax函数 3.6算法过程 3.7 求softmax 四、skipgram代码实现 4.1 如何把词转换为向量 4.2 CBOW和Skip-gram的算法实现 Skip-gram的理想实现 Skip-gram的实际实现 4.3 使用Pytorch实现Skip-gram .

Python,数据分析,机器学习,深度学习 1万+

uni-app - 修改默认端口,H5 项目控制台运行出来的 IP 地址的默认端口号(H5 项目运行后控制台,修改项目运行到内置浏览器默认 8080 端口号)

uni-app运行到H5修改默认端口号,uni-app如何修改默认端口,uni-app修改默认端口,uni-app本地运行修改调试已上线微信H5项目,请问在UNIAPP的H5运行调试时候的IP是否可以自己设置固定,uni-app开发环境,如何设置h5服务器的端口,uni-app如何修改默认端,uni-app修改默认端口,uni-app指定端口号,uni-app-修改H5项目控制台运行出来的IP地址的默认端口号(H5项目运行后控制台,修改项目运行到内置浏览器默认8080端口号)

🏆 前端领域优质创作者 9884

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

Abandoninged的博客 625

注意力机制模块:注意力机制新宠:EMA 注意力(高效多尺度注意力),即插即用,涨点明显

无降维成为共识:越来越多的研究者意识到,传统注意力机制的通道降维操作会造成不可逆的信息损失。EMA 提出的“保留每个通道信息”理念正在成为新一代注意力模块的设计标准。分组并行走向成熟:特征分组 + 并行处理的设计范式已在多个前沿架构中得到验证,兼顾了表达能力和计算效率。多尺度与跨空间融合:单纯的多尺度或单纯的跨空间交互都已无法满足复杂任务需求,两者的深度融合是当前的主流方向。边缘部署导向:2026 年的新论文越来越关注在资源受限设备上的高效运行,轻量化设计成为评估注意力模块的重要指标。

ZXSXJ的博客 948

Codeforces 903B - The Modcrab 模拟+记录

模拟过程并记录 #include #include #include #include #include #include #include #include #include #include #include #define PI acos(-1.0) #define in freopen("in.txt", "r", stdin) #define out freopen("out.

床前明月光 596

WINCC7.3破解文件

WINCC7.3硬件够破解文件,有需要的下载!WINCC7.3硬件够破解文件,有需要的下载!

老版QQ原生表情gif动态

这是老版的QQ表情,不过全是动态的的,Windows照片查看器是不会动的,可以右击用浏览器打开查看,再说一遍是老版的,只是分享给宁愿用老版也要动态的人。

903B - The Modcrab

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

memory_qianxiao的博客 646

廖雪峰Python教程[完整版]

廖雪峰的python教程整理的,已经排好版了,而且还是完整的,适合小白

【Codeforces 903B】The Modcrab

【链接】 我是链接,点我呀:) 【题意】 【题解】 显然如果对方一次攻击能打死你。 那么你不能对他攻击了。必须加血。其他时候都只要攻击就可以了。 但也不一定非得加血。 因为有时候可以“绝杀”,就是虽然对方能打死你,但你也能在这回合打死对方。 这种情况就不用加血了。 【代码】 #include <bits/stdc++.h> using namespace ...

188

cf 903B - The Modcrab

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

Haipai1998的博客 347

codeforces 903B. The Modcrab(模拟)

题意:一个人在打怪,他每回合可以选择喝药加血或者打怪,然后怪物会攻击他一次,让你输出一个他可以打死怪物的方案(任意一个即可,特殊判定),但是注意他的血量可以无上限。第一行输入他的当前血量h1,攻击力a1,药每次回复c的血量,第二行输入怪物的血量h2,怪物的攻击力a2。 思路:因为血量无上限,所以我们可以先把血加到一个刚好能打死怪物的血量,然后再开始打怪。 加血的时候怪也会攻击你。我因为这个WA

张松超的博客 694

Educational Codeforces Round 34 B. The Modcrab【模拟/STL】

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

weixin_30779691的博客 98

Educational Codeforces Round 34 (Rated for Div. 2)B. The Modcrab(贪心)

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

WhaleFall 241

Educational Codeforces Round 34 (Rated for Div. 2) B题【打怪模拟】

B. The ModcrabVova 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 gam...

baan7498的博客 511

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 standard input output standard output Ivan's classes at the university h...

weixin_33897722的博客 67

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

A. Hungry Student Problem Ivan's classes at the university have just finished, and now he wants to go to the local CFK cafe and eat some fried chicken. CFK sells chicken chunks in small and la...

weixin_30367873的博客 113

B-The Modcrab

B. The Modcrabtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputVova is again playing some computer game, now an RPG. In the game Vova's character re

qq_40129237的博客 331

Codeforece Educational Codeforces Round 34 (Rated for Div. 2) (A-D)题解

A: A. Hungry Student Problem time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Ivan's classes at the uni...

weixin_30677073的博客 254

cf round 34(div2) B

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

cbzhunian 242

8 1 个人赛 to me

E Everybody in Russia uses Gregorian calendar. In this calendar there are 31 days in January, 28 or 29 days in February (depending on whether the year is leap or not), 31 days in Mar...

weixin_30344795的博客 165
上一篇: Aladdin and the Flying Carpet LightOJ - 1341(算数基本定理)
下一篇: Card Game (First Edition) FZU - 2264
Guuuuuu老师儿
博客等级 码龄9年 259粉丝 718原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值