对于第一种方案,枚举补给凭证购买次数 i (0≤i≤⌈30m⌉),计算购买补给凭证可以获得的晶核数量 300+min(i×30,m)×90,将一二种方案的花费累加并对答案取最小值即可。
#include <bits/stdc++.h>
using namespace std;
/*====================*/
#define ios_close ios::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL)
#define yes puts("Yes")
#define no puts("No")
小明正在为即将到来的挑战积攒能量晶核,他需要在最多 m 天之内凑齐至少 n 个能量晶核。目前他的晶核数量为 0。
获取晶核有两种途径:
小明希望花费尽可能少的钱达到目标。请你帮他计算最少需要花费多少元。
约束:1≤n≤2×105,1≤m≤240。
By signing up a CodeFun2000 universal account, you can submit code and join discussions in all online judging services provided by us.