Codeforces Round #278 (Div. 2) 488C.Fight the Monster
来源:互联网 发布:打开key的软件 编辑:程序博客网 时间:2024/05/17 09:14
题意:人和怪物都有三个属性:血量,攻击力,防御力。人可以买属性,问打败怪兽需要花的最少的钱是多少。
枚举买多少三种属性。开始看题目范围都是100...然后枚举一百在比赛中过了.出来直接跪了..枚举了200攻击200防御1000血量直接AC..好无奈。
#include<stdlib.h>#include<string.h>#include<stdio.h>#define INF 0x7fffffffint min(int x,int y){if(x<y)return x;return y;}int main(){int wh,wa,wd,mh,ma,md,ch,ca,cd;scanf("%d %d %d",&wh,&wa,&wd);scanf("%d %d %d",&mh,&ma,&md);scanf("%d %d %d",&ch,&ca,&cd);int cost = INF;for(int da=0;da<=200;da++){for(int dd=0;dd<=200;dd++){for(int dh=0;dh<=1000;dh++){if(wa+da-md<=0) continue;int t = (mh-1)/(wa+da-md)+1;if(dh<t*(ma-wd-dd)-wh+1) continue;cost = min(cost,ca*da+cd*dd+ch*dh);}}}printf("%d\n",cost);return 0;}
0 0
- Codeforces Round #278 (Div. 2) 488C.Fight the Monster
- Codeforces Round #278 (Div. 2) C. Fight the Monster(暴力)
- Codeforces Round #278 (Div. 2) C. Fight the Monster 二分+枚举
- Codeforces Round #278 (Div. 1) A. Fight the Monster( 暴力)
- Codeforces 488 C. Fight the Monster(模拟)
- codeforces 488C Fight the Monster(枚举)
- Codeforces 488C Fight the Monster【二分+枚举】
- CodeForces 488 C.Fight the Monster(枚举)
- codeforces 487A Fight the Monster
- 【Codeforces】 487A Fight the Monster
- CodeForces 487A Fight the Monster
- codeforces #487A# Fight the Monster(枚举)
- Codeforces 487A Fight the Monster(暴力)
- Codeforces 487A Fight the Monster
- Codeforces Round #328 (Div. 2)_B. The Monster and the Squirrel
- Codeforces Round #328 (Div. 2) B. The Monster and the Squirrel(数学规律)
- Codeforces Round #328 (Div. 2) B. The Monster and the Squirrel
- Codeforces Round #328 (Div. 2)B. The Monster and the Squirrel
- Hibernnate编程基础-基础框架的搭建
- 有关二叉树的中序遍历
- 自己动手写工具----签到器
- retain和copy的区别
- 野指针、空指针
- Codeforces Round #278 (Div. 2) 488C.Fight the Monster
- android之实现各个组件点击事件处理
- mysql commond
- fstream::good
- 安卓互联网恶意软件危害用户
- hist()R 直方图
- net利用quartz任务调度,开发Job管理系统一
- printf("%x.yf",n)
- 360和baidu的战争号角再次吹响