Codeforces Round #278 (Div. 1) A. Fight the Monster 暴力

时间:2022-04-16 03:56:49

A. Fight the Monster

Time Limit: 20 Sec

Memory Limit: 256 MB

题目连接

http://codeforces.com/contest/487/problem/A

Description

A monster is attacking the Cyberland!

Master Yang, a braver, is going to beat the monster. Yang and the monster each have 3 attributes: hitpoints (HP), offensive power (ATK) and defensive power (DEF).

During the battle, every second the monster's HP decrease by max(0, ATKY - DEFM), while Yang's HP decreases by max(0, ATKM - DEFY), where index Y denotes Master Yang and index M denotes monster. Both decreases happen simultaneously Once monster's HP ≤ 0 and the same time Master Yang's HP > 0, Master Yang wins.

Master Yang can buy attributes from the magic shop of Cyberland: h bitcoins per HP, a bitcoins per ATK, and d bitcoins per DEF.

Now Master Yang wants to know the minimum number of bitcoins he can spend in order to win.

⋅1. If you touch a buoy before your opponent, you will get one point. For example if your opponent touch the buoy #2 before you after start, he will score one point. So when you touch the buoy #2, you won't get any point. Meanwhile, you cannot touch buoy #3 or any other buoys before touching the buoy #2.

⋅2. Ignoring the buoys and relying on dogfighting to get point.
If you and your opponent meet in the same position, you can try to
fight with your opponent to score one point. For the proposal of game
balance, two players are not allowed to fight before buoy #2 is touched by anybody.

There are three types of players.

Speeder:
As a player specializing in high speed movement, he/she tries to avoid
dogfighting while attempting to gain points by touching buoys.
Fighter:
As a player specializing in dogfighting, he/she always tries to fight
with the opponent to score points. Since a fighter is slower than a
speeder, it's difficult for him/her to score points by touching buoys
when the opponent is a speeder.
All-Rounder: A balanced player between Fighter and Speeder.

There will be a training match between Asuka (All-Rounder) and Shion (Speeder).
Since the match is only a training match, the rules are simplified: the game will end after the buoy #1 is touched by anybody. Shion is a speed lover, and his strategy is very simple: touch buoy #2,#3,#4,#1 along the shortest path.

Asuka is good at dogfighting, so she will always score one point by dogfighting with Shion, and the opponent will be stunned for T seconds after dogfighting.
Since Asuka is slower than Shion, she decides to fight with Shion for
only one time during the match. It is also assumed that if Asuka and
Shion touch the buoy in the same time, the point will be given to Asuka
and Asuka could also fight with Shion at the buoy. We assume that in
such scenario, the dogfighting must happen after the buoy is touched by
Asuka or Shion.

The speed of Asuka is V1 m/s. The speed of Shion is V2 m/s. Is there any possibility for Asuka to win the match (to have higher score)?

Input

The first line contains three integers HPY, ATKY, DEFY, separated by a space, denoting the initial HP, ATK and DEF of Master Yang.

The second line contains three integers HPM, ATKM, DEFM, separated by a space, denoting the HP, ATK and DEF of the monster.

The third line contains three integers h, a, d, separated by a space, denoting the price of 1 HP, 1 ATK and 1 DEF.

All numbers in input are integer and lie between 1 and 100 inclusively.

Output

The only output line should contain an integer, denoting the minimum bitcoins Master Yang should spend in order to win.

Sample Input

1 2 1
1 100 1
1 100 100

Sample Output

99

HINT

题意

给你英雄 H1点血量 A1点攻击 D1点防御

然后怪兽也是 H2点血量 A2点攻击 D2点防御

然后你可以花h元提升一点血量,a元提升一点攻击,d元提升一点防御

然后问你最少花多少钱可以打败他,并且你不死

题解:

爆爆爆,直接暴力枚举提升多大的攻击力,提升多大的防御力就好了

代码

#include<iostream>
#include<stdio.h>
using namespace std; int main()
{
int h1,a1,d1;
int h2,a2,d2;
int h,a,d;
cin>>h1>>a1>>d1;
cin>>h2>>a2>>d2;
cin>>h>>a>>d;
h1--;
long long ans = 999999999LL;
for(int i=;i<;i++)
{
if(a1+i>d2)
{
for(int j=;j<;j++)
{
int temp = i*a+j*d;
int D = j+d1;
int A = i+a1-d2;
int t = (h2+A-)/(A);
temp+=max(t*(a2-D)-h1*1LL,0LL)*h;
ans=min(temp*1LL,ans);
}
}
}
cout<<ans<<endl;
}