CodeForces
来源:互联网 发布:使命召唤14二战 知乎 编辑:程序博客网 时间:2024/05/22 08:26
Little Vasya went to the supermarket to get some groceries. He walked about the supermarket for a long time and got a basket full of products. Now he needs to choose the cashier to pay for the products.
There are n cashiers at the exit from the supermarket. At the moment the queue for the i-th cashier already has ki people. The j-th person standing in the queue to the i-th cashier has mi, j items in the basket. Vasya knows that:
- the cashier needs 5 seconds to scan one item;
- after the cashier scans each item of some customer, he needs 15 seconds to take the customer's money and give him the change.
Of course, Vasya wants to select a queue so that he can leave the supermarket as soon as possible. Help him write a program that displays the minimum number of seconds after which Vasya can get to one of the cashiers.
The first line contains integer n (1 ≤ n ≤ 100) — the number of cashes in the shop. The second line contains n space-separated integers: k1, k2, ..., kn (1 ≤ ki ≤ 100), where ki is the number of people in the queue to the i-th cashier.
The i-th of the next n lines contains ki space-separated integers: mi, 1, mi, 2, ..., mi, ki (1 ≤ mi, j ≤ 100) — the number of products the j-th person in the queue for the i-th cash has.
Print a single integer — the minimum number of seconds Vasya needs to get to the cashier.
111
20
41 4 3 21001 2 2 31 9 17 8
100
AC代码:
#include<cstdio>#include<algorithm>using namespace std;int main(){int n;int s[110],s1;scanf("%d",&n);for(int i=1;i<=n;i++){scanf("%d",&s[i]);}int sum=0,minn=99999999;for(int i=1;i<=n;i++){sum=0;for(int j=1;j<=s[i];j++){scanf("%d",&s1);sum+=5*s1;}sum+=15*s[i];minn=min(sum,minn);}printf("%d",minn);return 0;}
- codeforces~~~
- Codeforces
- codeforces
- Codeforces
- codeforces
- codeforces
- Codeforces
- Codeforces
- CodeForces
- CodeForces
- CodeForces
- CodeForces
- CodeForces
- Codeforces
- Codeforces
- Codeforces
- Codeforces
- Codeforces
- dirname和basename用法
- 用SQL数据库做多表关联应怎样设计库结构
- POJ-1182-食物链 [种类并查集]
- 这是个序
- 笔试题2——判断链表是否有环,若有则返回环的第一个交点
- CodeForces
- 产品经理如何编写产品PK测试方案
- iOS 多线程的部分使用
- QT串口通信实例
- Python3基础-字符串
- 16.Scala中包的定义、包对象、包的引用、包的隐式引用代码实战
- 集合工具类
- mysql中常用的语句
- ios 模仿直播软件