define _CRT_SECURE_NO_WARNINGS
include [HTML_REMOVED]
include[HTML_REMOVED]
int main()
{
// B,L J H
// 0 1 2 3
char material[20] = { 0 };
int need[4] = { 0 };
int price[4] = { 0 };
int have[4] = { 0 };
int budget;
scanf(“%s”, &material);
int max_level = 0;
for (int i = 0; i <20; i)
{
switch (material[i])
{
case ‘B’:need[0];
break;
case’L’:need[1];
break;
case’J’:need[2];
break;
case’H’:need[3]++;
break;
}
}
//input price
for (int i = 0; i < 4; i++)
{
scanf("%d", &price[i]);
}
//input have
for (int i = 0; i < 4; i++)
{
scanf("%d", &have[i]);
}
scanf("%d", &budget);
//求最大等级
while (budget>0)
{
int p = 0;
for (int i = 0; i < 4; i++)
{
if (have[i]<need[i])
{
budget -= (price[i]*(need[i]-have[i]));
have[i]=need[i];
}
if(budget<0)
break;
have[i] = have[i] - need[i];
++p;
if (p == 4)
max_level++;
}
}
printf("%d", max_level * 10);
return 0;
}