比赛入口
还有两题太难理解…没看懂…
划分树是树形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数组利用好。
代码: