编程介的小学生 2019-08-27 18:30 采纳率: 20.5%
浏览 139

KFC -Z+W 用C语言来做

Problem Description
Welcome 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.

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

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
    • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
    • ¥30 截图中的mathematics程序转换成matlab
    • ¥15 动力学代码报错,维度不匹配
    • ¥15 Power query添加列问题
    • ¥50 Kubernetes&Fission&Eleasticsearch
    • ¥15 報錯:Person is not mapped,如何解決?
    • ¥15 c++头文件不能识别CDialog
    • ¥15 Excel发现不可读取的内容
    • ¥15 关于#stm32#的问题:CANOpen的PDO同步传输问题