17.04.29 KFC -Z+W
来源:互联网 发布:the greedy python 编辑:程序博客网 时间:2024/05/18 00:30
KFC -Z+W
HDU - 4147Welcome to KFC!
We love KFC, but we hate the looooooooooong queue.
Z is a programmer; he’s got an idea on the queue time computing.
Z chooses the shortest queue at first time.
He wrote a j2me program to predicate the time he have to wait in the queue. Now, he comes to KFC to test his program.
BUT, he ignored some important things to get the precise time.
* People choose different foods
* Time used on foods various
W encountered him just while his wondering on the problem, so he discussed it with HER.
W suggested that they can add variables to this
* A type ,who is looking down on the cell phone novel should come here alone, will call for 1 hamburger, 1 drink and 1 small fries
* B type, two talkative lovers, 1 hamburger and 1 drink for each one and another big fires
* C type, middle aged father/mother looks, brings their child out. 3 hamburgers, 3 drinks and two big friezes.
Generally represent the types usually appear, not the exactly math work.
They reprogram the app on W’s HTC-G1 with bash, run it and go for the fastest queue.
We love KFC, but we hate the looooooooooong queue.
Z is a programmer; he’s got an idea on the queue time computing.
Z chooses the shortest queue at first time.
He wrote a j2me program to predicate the time he have to wait in the queue. Now, he comes to KFC to test his program.
BUT, he ignored some important things to get the precise time.
* People choose different foods
* Time used on foods various
W encountered him just while his wondering on the problem, so he discussed it with HER.
W suggested that they can add variables to this
* A type ,who is looking down on the cell phone novel should come here alone, will call for 1 hamburger, 1 drink and 1 small fries
* B type, two talkative lovers, 1 hamburger and 1 drink for each one and another big fires
* C type, middle aged father/mother looks, brings their child out. 3 hamburgers, 3 drinks and two big friezes.
Generally represent the types usually appear, not the exactly math work.
They reprogram the app on W’s HTC-G1 with bash, run it and go for the fastest queue.
Input
Input contains multiple test cases, and for each case:
First line: n B D f F, stands for n queues, time for hamburger B, time for Drink D, time for small fries f, time for big Fries F.
The next n lines: the types of each line using ABC characters.
(1<n,B,D,f,F<=100)
Output
For each case, please output the least time to wait in one line.
Sample Input
3 2 2 1 2
ABCCBACBCBAB
CBCBABBCBA
ABC
Sample Output
31
————————————
水题,先算出A/B/C各需要多少时间,再读一个字符串算一条队伍要多少时间,跟当前最小的比较,最后输出最小的就行了。
#include<stdio.h>#include<string.h>int main(){ int n,b,d,f,fm; while(scanf("%d",&n)&&scanf("%d",&b)&&scanf("%d",&d)&&scanf("%d",&f)&&scanf("%d",&fm)!=EOF) { int i;int minn=99999; int ap=b+d+f,bp=2*b+2*d+fm,cp=3*b+3*d+2*fm; while(n--) { char ss[105]; scanf("%s",&ss); int sum=0; for(i=0;i<=strlen(ss);i++) { if(ss[i]=='A')sum+=ap; if(ss[i]=='B')sum+=bp; if(ss[i]=='C')sum+=cp; } if(sum<minn)minn=sum; } printf("%d\n",minn); }}
1 0
- 17.04.29 KFC -Z+W
- HDU4147 KFC -Z+W
- HDU 4147 KFC -Z+W
- HDU 4147KFC -Z+W
- HDU菜鸟杯大赛第五题 KFC -Z+W
- 2011百校联动“菜鸟杯”程序设计公开赛&&KFC -Z+W
- 【模拟】HDU4147KFC -Z+W
- Z-Buffer 与 W-Buffer
- Z buffer 和 W buffer
- Z-Buffer 和 W-Buffer
- z-buffer 与 w-buffer
- Z-buffer与W-buffer
- DUMP(w[,x[,y[,z]]])
- Z buffer 和 W buffer 簡介
- Z buffer 和 W buffer 簡介
- Z buffer 和 W buffer 簡介
- 详细介绍Z-Buffer与W-Buffer
- Z buffer 和 W buffer 簡介
- Advanced Fruits(最长公共子序列)
- 深度学习链接
- Java简单笔试题(三)
- Java并发包中Lock的实现原理
- C# 从网络上获取图片
- 17.04.29 KFC -Z+W
- HDU 2001 计算两点间距离 新手水题
- STL标准库中vector list deque的区别
- PHP设计模式系列(五):原型模式
- 搜索练习4/hdu.edu.cn/problem1241 /Oil Deposits/基础dfs
- cjson添加到Cocos2d-lua项目中
- Hdfs的JAVA客户端基本操作
- Linux apache-activemq安装及配置
- 简书那些事儿