poj 3465 回溯+贪心

lgv20刷twrp_LG港版v20 root 这是LG港版v20 root,整理了一下有关LG港版v20的官方固件包了,有没有需要的呢,这里把固件包整理一下也是方便大家以后好下载了,因此有一些机友还是不知道在哪里下载官方的rom包,在这里说的固件rom包也就是原版的系统包了,大家可以放心的使用,这些系统包也都是支持线刷的,大家下载下来解压出来根据里面的相关教程来操作就可以了,很简单的,如果你也需要的话就一起来看看吧。软件提示注意!! 此过程会... 阅读详情
Battle
Time Limit: 2000MS Memory Limit: 131072K
Total Submissions: 1911 Accepted: 476

Description

You're Zhu Rengong, a formidable hero. After a number of challenging missions, you are finally facing the final Boss – a black dragon called Heilong. Due to his overwhelming power, you have to plan your actions carefully.

You have H1 hit points (HP) at the beginning of the battle, and Heilong has H2. Heilong attacks you each time you do an action, and deal Ai points of damage in the i-th round. You have three kinds of actions.

  • Attack. You attack Heilong, and do x points of damage.
  • Defend. You focus on avoiding the attack of Heilong. This action nullifies Heilong's attack in this round.
  • Heal. You heal yourself, adding y hit points to yourself. There is no upper bound on your HP.

If anyone's HP drop below or equal to 0, he dies. If you can't kill the dragon within N rounds, you will also die. So you need to know how many rounds you need to kill the black dragon. If you cannot kill him, you will have to calculate the maximal damage you can do on Heilong.

Input

The first line contains five integers, N, x, y, H1, H2. 1 ≤ N ≤ 105, 1 ≤ x,y ≤ 104, 1 ≤ H1,H2 ≤ 109. Then follow N lines, the ith line contains one integer Ai-1. 1 ≤ Ai-1 ≤ 104.

Output

If you can kill Heilong, the first line of your output should be "Win". Otherwise "Lose".
The second line contains the number of rounds you need to kill Heilong if the first line is "Win", or the maximal damage you can do if the first line is "Lose".

Sample Input

Sample Input 1 4 1 1 3 3 1 10 1 10

Sample Input 2 4 1 1000 1 4 1 10 1 1

Sample Output

Sample Output 1 Win 4

Sample Output 2 Lose 3

Hint

In Sample 1, you have to defend in the 2nd round, othewise you will die. 
In Sample 2, you heal yourself in the first round, and keep attacking until  N rounds expires.

Source

POJ Monthly--2007.11.25, Yang Yi


#include <iostream>
#include <cstring>
#include <cstdio>
#include <algorithm>
#include <queue>

using namespace std;

#define maxn 100001
int n,x,y,h1,h2;
int a[maxn];

int main()
{
    while(~scanf("%d%d%d%d%d", &n, &x, &y, &h1, &h2)){
        for(int i = 0; i < n; i++)
            scanf("%d", a+i);

        priority_queue<int> que;
        int tmp = h2;
        int ans = 0, maxi = 0;
        for(int i = 0; i < n; i++){
            if(h2 <= x){
                ans = i+1;
                break;
            }

            que.push(max(y, a[i]));
            h2-=x;
            maxi = max(tmp-h2, maxi);
            h1-=a[i];
            while(h1 <= 0 && !que.empty()){
                h1 += que.top(); que.pop();
                h2 += x;
            }
        }

        if(ans)
            printf("Win\n%d\n", ans);
        else printf("Lose\n%d\n", maxi);


    }
    return 0;
}


为什么你的XGBoost多分类效果不如预期?可能是这5个参数没调对 本文深度剖析了XGBoost模型在处理多分类问题时效果不佳的五大关键参数陷阱。针对多分类问题的独特性,文章提供了max_depth、learning_rate、采样参数及正则化参数等核心参数的量化调整策略与诊断方法,帮助开发者精准调优,有效提升模型在各类别上的均衡性能与泛化能力。 阅读详情

相关推荐

系统安装、qt配置、安装pcie驱动

提示:文章写完后,目录可以自动生成,如何生成可参考右边的帮助文档 安装Linux系统指定:ununtu20.04并配置相关软件环境 前言 提示:这里可以添加本文要记录的大概内容: ununtu20.04、Qt 5.9.0、pcie驱动 提示:以下是本篇文章正文内容,下面案例可供参考 一、安装系统 制作系统盘(win10),在开机时按相应键进入BIOS,(华硕需要先改配置启动->CSM->开启->第一个选项选第一个或第二个),等待即可 进入后按照https://www.sysgeek.

weixin_44832804的博客 2205

poj3465(贪心+优先队列)

Battle Time Limit: 2000MS   Memory Limit: 131072K Total Submissions: 1851   Accepted: 455 Description You're Zhu Rengong, a formidable hero. After a number of challenging

u011044759的专栏 1451

CESM笔记——CESM1.0-CESM1.2.2-CESM2.1.3三个版本模式工作流对比

最近测试了CESM1.0,CESM1.2.2和CESM2.1.3三个版本,不同版本在workflow上有一些区别,来做点笔记。 CESM1.0 测试compset:B_2000,F_2000 workflow: 1. create_newcase -case ~/CESM/cesm1_0/script/B_2000 -compset B_2000 -res f19_g16 -mach tianhe 2. cd B_2000 (optional) env_mach_pes.xml ##修改核数,

砍柴姑娘Jourosy的博客 4943

POJ 3465 Battle 可能会

woniupengpeng的专栏 293

机器学习——Anaconda下载安装教程

Anaconda详细下载安装教程

2401_83693485的博客 3065

一文读懂客户健康度

什么是客户健康度?客户健康度为什么重要?怎么计算客户健康度?这篇文章,我们来聊聊。

m0_62700043的博客 1419

poj3465 贪心+优先队列

题意:你跟一个boss作战,回合制的,你先boss后,boss只会攻击,且每回合造成的伤害为a[i],而你有三种动作,第一是攻击boss,对它造成x点伤害,第二是对boss的该回合攻击免疫,第三是恢复y点生命值,如果n回合后boss没死,你输,如果中途你的生命值掉到0你输,如果输了输出对boss造成的最大伤害,如果赢了输出最少的回合数。 难度:中档题。 思路:首先是贪心的思路,我们先每次都做攻

、Poppy 678

Voltus功耗分析——读入Innovus数据/cpf/spef文件

检查的内容:物理库、时序库、网表、I/Os、tie-high&tie-low pins、电源/地pins。设计数据(LEF/DEF/netlist)、cpf文件、SPEF文件。方法二:定义每个 power/ground net's 电压。4.设计数据检查(design sanity check)方法一:读入.dat数据。方法二:读入def文件。方法一:读入CPF文件。

qq_44347276的博客 3984

POJ 3465 Battle(优先队列+贪心模拟)

You're Zhu Rengong, a formidable hero. After a number of challenging missions, you are finally facing the final Boss – a black dragon called Heilong. Due to his overwhelming power, you have to plan your actions carefully. You have H1 hit points (HP) at the

HJY 494

机械臂开发必备:KDL库正逆解与动力学实战指南

在机器人算法领域,运动学与动力学计算是机械臂控制、仿真与轨迹规划的核心基础。正运动学描述关节空间到笛卡尔空间的映射,逆运动学则需要求解复杂的非线性方程,工程实现时常面临数值稳定性与调试效率的挑战。KDL(Kinematics and Dynamics Library)作为ROS生态中广泛使用的开源库,提供了统一的模型描述与高效求解器,将正逆解、雅可比矩阵及动力学参数计算封装为简洁接口,大幅降低开发门槛。无论是机械臂的笛卡尔空间轨迹跟踪,还是基于动力学模型的前馈控制,KDL都展现出强大的工程价值。本文从运动学

weixin_33860528的博客 2506

解决RuntimeError: Couldn‘t load custom C++ ops. This can happen if your PyTorch

刚下好yolov8的代码,想测一下能否成果,果然没成功,报错如下简单来说就是torchvision和torch不匹配,就很离谱,我照着版本对应关系pip install的啊,怎么会不匹配建议先看看你的版本我是下图红框这个首先确定自己torch没问题,因为我的3090这个卡目前cuda版本是11.1,这个whl是早就下好的,一般1-2G,有问题重新下就麻烦了然后我pip install了很多次torchvision==0.11.3,都没啥用。想试着改改版本,结果要下其他的torch版本,就更不可能了。

DZY的博客 2247

POJ1256 Anagram(回溯法)

题意: 输出字符串中字符的所有排列方式 要点: 回溯法可以将每种情况遍历一遍(注意跳过连续的相同的字符),重点在于排序,先排序再回溯可以保证输出按照字典序,但这题的排序不太一样:'A'<'a'<'B'<'b'<...<'Z'<'z',所以cmp要分情况讨论才行 15178810 Seasonal 1256 Accepted...

weixin_33910137的博客 279

嵌入式工程师必学(118):MCU的硬件定时器和中断

大多数微处理器都有一个或多个可编程硬件定时器,这些定时器包括对中断的支持。可以有不同类型的计时器,用于不同的应用程序。例如,LPC1768 具有四个 32 位通用定时器、一个看门狗定时器、一个重复中断定时器、一个系统滴答定时器、一个正交编码器接口、6 个 PWM 输出和一个支持中断的实时时钟。硬件定时器用于计时和计数作,允许处理器在 timer 进程运行时继续执行其他进程。硬件定时器是一种使用 clock 信号来增加 register 的电路。

码农17年的博客 211

poj2488(回溯板子题)

存着做模板 #include #include #include using namespace std; int dir[8][2] = { {-1, -2}, {1, -2}, {-2, -1}, {2, -1}, {-2, 1}, {2, 1}, {-1, 2}, {1, 2} }; int p, q, b[27][27]; struct Map { int y, x; }a

林伏案的博客 395

ET2012新版免狗免安装绿色软件

ET2012新版免狗免安祖昂绿色软件。,新界面,新视觉,

WINCC7.3破解文件

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

0.8poj2078(回溯||dfs)

http://poj.org/problem?id=2078 Matrix Time Limit: 2000MS Memory Limit: 30000K Total Submissions: 3022 Accepted: 1561 Description Given an n*n matrix A, whose entries Ai,j are integer numbe

ZhouRush 772

C# WinForm 基于DirectShow.dll编写的程序,可边预览边保存视频,音频和图片

基于微软的DirectShow.dll的二次开发1.自动识别连接的摄像头跟麦克风且可以对其进行选择(默认选中第一个)2.可录制wmv和avi两种格式的视频并且都带有音频,avi可以录制的分辨率和帧数进行选择,wmv默认进行了淸晰度优化如不喜欢可去除代码中有相关提示3.可在预览点开之后进行拍照,也可边录制视频边拍照4.添加了视频和音频的压缩功能(酌情使用)这次二次开发发现C#对DirectShow的相关信息太少,这次做完也不敢藏私共享出来,还望大家指正

poj 3984 迷宫问题(BFS+回溯)

迷宫问题 Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 11256   Accepted: 6733 点击打开链接 Description 定义一个二维数组:  int maze[5][5] = { 0, 1, 0, 0, 0, 0, 1, 0

亿念之茶的专栏 1787

LinePhone3.2.7(android端最新版本) sip客户端

SIP客户端For android:LinePhone3.2.7(最新版本),官网地址:http://www.linphone.org/

poj-3414 Pots(BFS 回溯)

Pots Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 33057 Accepted: 13667 Special Judge Description You are given two pots, having the volume of A and B liters respectively. The following operations can be performed: FILL(i) fill the

weixin_47750287的博客 256

poj1979(回溯)

Red and BlackTime Limit: 1000MS Memory Limit: 30000KTotal Submissions: 41029 Accepted: 22258DescriptionThere is a rectangular room, covered with square tiles. Each tile is colored either red or black....

luojiushenzi的博客 358

poj--2676--回溯

很久很久前 就做过数独了 当时一直没做出来了 这次 也磕磕绊绊 终于过了.... 数独题 真的很好 对于回溯的理解 很有帮助 一下子 觉得 全垒打的节奏...         touch me 1 #include <iostream> 2 #include <cstring> 3 using namespace std; 4 ...

weixin_30457551的博客 164

poj1040transportation(回溯)

TransportationTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 4980 Accepted: 2042DescriptionRuratania is just entering capitalism and is establishing new enterprising activities in many fiel...

luojiushenzi的博客 427

POJ 2531 dfs回溯(小剪枝)

Network Saboteur Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 10381 Accepted: 4988 DescriptionA university network is composed of N computers. System administrators gathere

仰望天空 924

POJ 3465Battle

题目来源: http://poj.org/problem?id=3465 排位赛遇到的一道,直接贪心。 #include<cstdio> #include<cstring> #include<iostream> #include<cstdlib> #include<algorithm> #include<cmath> ...

weixin_43958964的博客 190

GPT-4稀疏激活真相:1.8万亿参数如何实现2%高效计算

混合专家(MoE)是突破大模型显存与算力瓶颈的核心架构,其本质是通过动态路由实现参数稀疏激活——在单次前向传播中仅调用部分专家子网络,而非全量参数参与计算。这一机制使模型总参数量(如1.8万亿)与实际计算量(如约2%)解耦,显著降低推理延迟与显存占用。技术价值在于兼顾模型容量与部署可行性,支撑长上下文、多领域泛化及消费级硬件适配。典型应用场景包括LLM推理服务优化、MoE模型选型(如Mixtral/Qwen2-MoE/DeepSeek-MoE)、资源规划与Router负载均衡调优。本文深入解析稀疏激活的工程

weixin_34318326的博客 438

POJ3465-Battle

BattleYou’re Zhu Rengong, a formidable hero. After a number of challenging missions, you are finally facing the final Boss – a black dragon called Heilong. Due to his overwhelming power, you have to pl

algzjh的博客 584

poj 3465 贪心+优先队列 叉姐的魔法训练

Battle Time Limit: 2000MS   Memory Limit: 131072K Total Submissions: 2196   Accepted: 564 Description You're Zhu Rengong, a formidable hero. After a number of challen

转角的守望 887

poj_1288_回溯

题目描述:      就是给一系列frame(字母构成的矩形边框,一个frame为一个大写字母组成的边框)。然后给一张图(矩形阵列),该图是fame按照某个次序往上覆盖的结果显示。   解题思路:    回溯。注意的地方比较多,首先是结果图的存储问题,需要记录争取的字母框四条边位置;其次是回溯的思路,从顶层开始找符合条件的frame,直到最底层;最后是字典序输出问题,这个题理论上26个字母最大结果

河洛 557
上一篇: cf 484b 二分搜索/区间最值
下一篇: cf 276b 博弈
HuanTongH
博客等级 码龄12年 7粉丝 110原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值