#pragma GCC optimize(3)
#include <cstdio>
#include <iostream>
using namespace std;
typedef long long LL;
const int N = 66, K = 15;
int n, m, k; //关数 能量总数 战术种数
double ans;
struct Node {
double w, gs, b, bs, gz; //武装增伤 攻击速度 暴击率 暴击伤害 过载概率
int nl; //能量数
int cnt; //个数
double ans; //增伤值
}f[11][N][K], p[K];
int main() {
// 武装 攻速 暴击 暴伤 过载 能量
p[++ k] = {0.00, 0.20, 0.01, 0.00, 0.08, 355, 0}; // 狂战神
p[++ k] = {0.20, 0.00, 0.03, 0.00, 0.00, 300, 0}; // 星陨
p[++ k] = {0.00, 0.00, 0.00, 0.00, 0.00, 600, 0}; // 连射之心
p[++ k] = {0.00, 0.00, 0.00, 0.00, 0.00, 650, 0}; // 速度爆发
p[++ k] = {0.00, 0.20, 0.02, 0.00, 0.00, 200, 0}; // 传奇刷新
p[++ k] = {0.18, 0.18, 0.00, 0.00, 0.00, 280, 0}; // 迅捷狂涛
p[++ k] = {0.00, 0.00, 0.00, 0.00, 0.00, 500, 0}; // 致命暴击
p[++ k] = {0.00, 0.00, 0.03, 0.26, 0.00, 260, 0}; // 猩红暴击
p[++ k] = {0.00, 0.00, 0.10, 0.00, 0.00, 000, 0}; // 杀戮之击
p[++ k] = {0.00, 0.30, 0.00, 0.00, 0.00, 250, 0}; // 神行冲击
p[++ k] = {0.00, 0.00, 0.00, 1.00, 0.00, 300, 0}; // 神行雷霆
p[++ k] = {0.50, 0.00, 0.00, 0.00, 0.00, 275, 0}; // 神行太保
printf("#n关: 狂 星 连 速 传 迅 致 猩 杀 冲 雷 太\n");
for (n = 41; n <= 41; ++ n)
{
m = n * 500 - 320 * 6;
ans = 0;
for (p[1].cnt = 9 ; p[1].cnt <= 21; ++ p[1].cnt) // 狂战神
for (p[2].cnt = 8 ; p[2].cnt <= 12; ++ p[2].cnt) // 星陨
for (p[3].cnt = 0 ; p[3].cnt <= 0 ; ++ p[3].cnt) // 连射之心
for (p[4].cnt = 0 ; p[4].cnt <= 0 ; ++ p[4].cnt) // 速度爆发
for (p[5].cnt = 0 ; p[5].cnt <= 1 ; ++ p[5].cnt) // 传奇刷新
for (p[6].cnt = 0 ; p[6].cnt <= 0 ; ++ p[6].cnt) // 迅捷狂涛
for (p[7].cnt = 14; p[7].cnt <= 18; ++ p[7].cnt) // 致命暴击
for (p[8].cnt = 0 ; p[8].cnt <= 0 ; ++ p[8].cnt) // 猩红暴击
for (p[9].cnt = 1 ; p[9].cnt <= 1 ; ++ p[9].cnt) // 杀戮之击
for (p[10].cnt = 0 ; p[10].cnt <= 0 ; ++ p[10].cnt) // 神行冲击
for (p[11].cnt = 0 ; p[11].cnt <= 0 ; ++ p[11].cnt) // 神行雷霆
for (p[12].cnt = 0 ; p[12].cnt <= 0 ; ++ p[12].cnt) // 神行太保
{
int mm = 0, kk = 0;
for (int u = 1; u <= k; ++ u) mm += p[u].cnt * p[u].nl, kk += p[u].cnt;
if (mm > m || kk > 42) continue;
double gs = 0, gs_sx = 0, b = 0, gz = 0, w = 0, w_sx = 0, bs = 0, bs_sx = 0;
for (int u = 1; u <= k - 3; ++ u) gs = min(5.0, gs + p[u].cnt * p[u].gs);
gs_sx = min(5.0, gs_sx + p[10].cnt * p[10].gs);
for (int u = 1; u <= k; ++ u)
{
if (u != 9) b = min(b <= 0.45 ? 0.45 : b, b + p[u].cnt * p[u].b);
else b += min(0.15, p[u].cnt * p[u].b);
}
w += p[3].cnt * (int(gs * 100 / 5)) / 100.0 + 7.32;
for (int u = 1; u <= k - 3; ++ u) w += p[u].cnt * p[u].w;
w_sx = p[12].cnt * p[12].gs;
bs += p[4].cnt * (gs / 2) + p[7].cnt * (int(b / 2 * 100) * 8 / 100.0);
for (int u = 1; u <= k - 3; ++ u) bs += p[u].cnt * p[u].bs;
bs_sx = p[11].cnt * p[11].bs;
// b = 1;
double res = (w + w_sx) * (1 - b + b * (1.5 + (bs + bs_sx))) / (5 / (1.0 + min(5.0, gs + gs_sx))) * 1.2;
if (res > f[0][n][0].ans)
{
for (int i = 7; i > -1; -- i)
{
f[i][n][0].gs = i > 0 ? f[i - 1][n][0].gs : gs;
f[i][n][0].b = i > 0 ? f[i - 1][n][0].b : b;
f[i][n][0].w = i > 0 ? f[i - 1][n][0].w : w;
f[i][n][0].bs = i > 0 ? f[i - 1][n][0].bs : bs;
f[i][n][0].ans = i > 0 ? f[i - 1][n][0].ans : res;
for (int u = 1; u <= k; ++ u) f[i][n][u].cnt = i > 0 ? f[i - 1][n][u].cnt : p[u].cnt;
}
}
else if (res > f[1][n][0].ans)
{
for (int i = 7; i > 0; -- i)
{
f[i][n][0].gs = i > 1 ? f[i - 1][n][0].gs : gs;
f[i][n][0].b = i > 1 ? f[i - 1][n][0].b : b;
f[i][n][0].w = i > 1 ? f[i - 1][n][0].w : w;
f[i][n][0].bs = i > 1 ? f[i - 1][n][0].bs : bs;
f[i][n][0].ans = i > 1 ? f[i - 1][n][0].ans : res;
for (int u = 1; u <= k; ++ u) f[i][n][u].cnt = i > 1 ? f[i - 1][n][u].cnt : p[u].cnt;
}
}
else if (res > f[2][n][0].ans)
{
for (int i = 7; i > 1; -- i)
{
f[i][n][0].gs = i > 2 ? f[i - 1][n][0].gs : gs;
f[i][n][0].b = i > 2 ? f[i - 1][n][0].b : b;
f[i][n][0].w = i > 2 ? f[i - 1][n][0].w : w;
f[i][n][0].bs = i > 2 ? f[i - 1][n][0].bs : bs;
f[i][n][0].ans = i > 2 ? f[i - 1][n][0].ans : res;
for (int u = 1; u <= k; ++ u) f[i][n][u].cnt = i > 2 ? f[i - 1][n][u].cnt : p[u].cnt;
}
}
else if (res > f[3][n][0].ans)
{
for (int i = 7; i > 2; -- i)
{
f[i][n][0].gs = i > 3 ? f[i - 1][n][0].gs : gs;
f[i][n][0].b = i > 3 ? f[i - 1][n][0].b : b;
f[i][n][0].w = i > 3 ? f[i - 1][n][0].w : w;
f[i][n][0].bs = i > 3 ? f[i - 1][n][0].bs : bs;
f[i][n][0].ans = i > 3 ? f[i - 1][n][0].ans : res;
for (int u = 1; u <= k; ++ u) f[i][n][u].cnt = i > 3 ? f[i - 1][n][u].cnt : p[u].cnt;
}
}
else if (res > f[4][n][0].ans)
{
for (int i = 7; i > 3; -- i)
{
f[i][n][0].gs = i > 3 ? f[i - 1][n][0].gs : gs;
f[i][n][0].b = i > 3 ? f[i - 1][n][0].b : b;
f[i][n][0].w = i > 3 ? f[i - 1][n][0].w : w;
f[i][n][0].bs = i > 3 ? f[i - 1][n][0].bs : bs;
f[i][n][0].ans = i > 3 ? f[i - 1][n][0].ans : res;
for (int u = 1; u <= k; ++ u) f[i][n][u].cnt = i > 4 ? f[i - 1][n][u].cnt : p[u].cnt;
}
}
else if (res > f[5][n][0].ans)
{
for (int i = 7; i > 4; -- i)
{
f[i][n][0].gs = i > 3 ? f[i - 1][n][0].gs : gs;
f[i][n][0].b = i > 3 ? f[i - 1][n][0].b : b;
f[i][n][0].w = i > 3 ? f[i - 1][n][0].w : w;
f[i][n][0].bs = i > 3 ? f[i - 1][n][0].bs : bs;
f[i][n][0].ans = i > 3 ? f[i - 1][n][0].ans : res;
for (int u = 1; u <= k; ++ u) f[i][n][u].cnt = i > 5 ? f[i - 1][n][u].cnt : p[u].cnt;
}
}
else if (res > f[6][n][0].ans)
{
for (int i = 7; i > 5; -- i)
{
f[i][n][0].gs = i > 3 ? f[i - 1][n][0].gs : gs;
f[i][n][0].b = i > 3 ? f[i - 1][n][0].b : b;
f[i][n][0].w = i > 3 ? f[i - 1][n][0].w : w;
f[i][n][0].bs = i > 3 ? f[i - 1][n][0].bs : bs;
f[i][n][0].ans = i > 3 ? f[i - 1][n][0].ans : res;
for (int u = 1; u <= k; ++ u) f[i][n][u].cnt = i > 6 ? f[i - 1][n][u].cnt : p[u].cnt;
}
}
else if (res > f[7][n][0].ans)
{
for (int i = 7; i > 6; -- i)
{
f[i][n][0].gs = i > 3 ? f[i - 1][n][0].gs : gs;
f[i][n][0].b = i > 3 ? f[i - 1][n][0].b : b;
f[i][n][0].w = i > 3 ? f[i - 1][n][0].w : w;
f[i][n][0].bs = i > 3 ? f[i - 1][n][0].bs : bs;
f[i][n][0].ans = i > 3 ? f[i - 1][n][0].ans : res;
for (int u = 1; u <= k; ++ u) f[i][n][u].cnt = i > 7 ? f[i - 1][n][u].cnt : p[u].cnt;
}
}
}
printf("#%d关: \n", n);
for (int i = 0; i < 8; ++ i)
{
printf("方案%d:", i + 1);
for (int u = 1; u <= k; ++ u) printf("%02d ", f[i][n][u].cnt);
printf("武装%.2lf 暴伤%.2lf 暴击%.2lf 攻速%.2lf ", f[i][n][0].w, f[i][n][0].bs, f[i][n][0].b, f[i][n][0].gs);
int mm = 0;
for (int u = 1; u <= k; ++ u) mm += f[i][n][u].cnt * p[u].nl;
printf("增伤值:%.3lf 剩余%d能量\n", f[i][n][0].ans, m - mm);
// printf("%lf %lf %lf %lf\n", f[i][n][0].gs, f[i][n][0].b, f[i][n][0].w, f[i][n][0].bs);
}
}
return 0;
}