补题:牛客练习赛57

比赛入口

还有两题太难理解…没看懂…
划分树是树形dp,但没看懂是咋dp的
最后函数求和貌似要用FFT,还没学…被自己菜哭

B 打 boss

做法:写这题时候脑子很乱(模拟杀我),最后写出来还是有因为考虑不周出现的小bug。

代码

#include<bits/stdc++.h>
#define fio ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define lson rt<<1, l, mid
#define rson rt<<1|1, mid+1, r
#define pii pair<int, int>
using namespace std;
typedef long long LL;
template<class T>
void read(T &res) {
   
  int f = 1; res = 0;
  char c = getchar();
  while(c < '0' || c > '9') {
    if(c == '-') f = -1; c = getchar(); }
  while(c >= '0' && c <= '9') {
    res = res * 10 + c - '0'; c = getchar(); }
  res *= f;
}
int main() {
   
  int t; read(t);
  LL hp1, hp2, atk1, atk2, m;
  while(t--) {
   
    read(hp1); read(hp2); read(atk1); read(atk2); read(m);
    if(hp2 <= atk1) puts("Yes");
    else if(m >= atk1) puts("No");
    else {
   
      //这里是关键,(hp2 - atk1) % (atk1 - m) 就能判断出怪物最后一轮是否能撑过玩家的攻击
      LL cnt = (hp2 - atk1) / (atk1 - m) + ((hp2 - atk1) % (atk1 - m) != 0);
      if(cnt * atk2 >= hp1) puts("No");
      else puts("Yes");
    }
  }
  return 0;
}


C 装货物

做法:具体的做法大概就是爆搜,要将vis数组利用好。

代码


                
  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值