Codeforces Round #278 (Div. 2) C
来源:互联网 发布:树熊网络登录 编辑:程序博客网 时间:2024/06/16 06:39
2014/11/27
昨天夜里想了一晚上,感觉很难,然后写的时候.....突然脑洞一裂:可以暴力啊, 相当于 x, y ,z三个变量,根据已知条件 ,确定 x,y,那么z也一定唯一。
然后就这么坑了发wa4就过了。
#include<stdio.h>#include<string.h>#include<climits>using namespace std;int Max(int a,int b){return a>b?a:b;}int Min(int a,int b){return a<b?a:b;}int main(){int a1,b1,c1;int a2,b2,c2;int h,a,d;int x,y,count;while(~scanf("%d%d%d",&a1,&b1,&c1)){scanf("%d%d%d",&a2,&b2,&c2);scanf("%d%d%d",&h,&a,&d);int minn = INT_MAX;if(a2==0){printf("0\n");continue ;}for(int i = b1;i <= 200; i++){if(i <= c2){continue ;}for(int j = c1;j <= 200; j++){int cnt;if(a2%(i-c2)){cnt = a2/(i-c2)+1;}else cnt = a2/(i-c2);int cost = h * Max(0,cnt * Max(0,b2-j) - a1 + 1) + (i-b1)*a+(j-c1)*d;if(minn > cost){minn = cost; count = cnt;x = i;y = j;}}}//printf("%d %d %d\n",count,x,y);printf("%d\n",minn);}return 0;}
0 0
- Codeforces Round #278 (Div. 2) C
- 【codeforces】Codeforces Round #370 (Div. 2) C
- Codeforces Round#278 Div.2
- Codeforces Round #278 (Div. 2)
- Codeforces Round #278 (Div. 2) 488C.Fight the Monster
- Codeforces Round #278 (Div. 2) C. Fight the Monster(暴力)
- Codeforces Round #105 (Div. 2) C
- Codeforces Round 134 div 2 C题
- Codeforces Round #137 (Div. 2), problem: (C)
- Codeforces Round #153 (Div. 2) C题
- Codeforces Round #158 (Div. 2) C题
- Codeforces Round #162 (Div. 2) C
- Codeforces Round #166 (Div. 2) c. Secret
- Codeforces Round#170(Div 2)C
- Codeforces Round #173 (Div. 2) Problem C
- Codeforces Round #192 (Div. 2) C. Purification
- Codeforces Round #196 (Div. 2) C. Quiz
- Codeforces Round #197 (Div. 2) (C~E)
- 链表读写文件
- 这个项目,涉及到的知识挺广泛的哦
- oracle 异常捕获
- js中的startWith、endWith、trim方法
- Merge k Sorted Lists -- leetcode
- Codeforces Round #278 (Div. 2) C
- Android中文API(136) —— GeoCoder
- 在 Emacs 里面使用 Cscope
- Jsoup入门:解析html 抽取数据
- HOWTO do Linux kernel development - take 3 (中文版)
- Sharepoint 2013 解决刷新 ExceBe careful. this workbook contains one or more queries that might be unsafe
- HTML5
- 实验三:顺序队列的实现
- Json数据 传递方式