wannafly day4 咆咆咆哮

2021-09-10 21:50:05 字數 620 閱讀 2788

題目鏈結 

題目大意:有n張牌,可以直接召喚乙個ai攻擊力的怪或者給當前在場上的怪全體加bi的攻擊力,求最後的總攻擊力的最大值

想多了,往dp想了,隊友說是貪心直接秒了

肯定是先召喚一堆怪,然後加buff

當前牌是召喚怪還是加buff只要看ai和當前在場上的怪的數量*bi的關係就可以

可以列舉出ai的數量,然後貪心排序得到當前方案的最好情況。比較一下就可以

#include #include #include #define ll long long

using namespace std;

const int maxn=1e3+5;

struct node

a[maxn];

int now_cnt;

bool cmp(node a,node b)

int main()

for(now_cnt=1;now_cnt<=n;now_cnt++)//列舉直接召喚的數量

for(int i=now_cnt+1;i<=n;i++)//加buff

ans=max(ans,tem_ans);

}cout

}