codevs 3022 西天收费站

3022 西天收费站

 
题目描述 Description

唐僧师徒四人终于发现西天就在眼前,但猴子突然发现前面有n个收费站(如来佛太可恶),在每个收费站用不同的方式要交的钱不同,输入每个收费站的每种方法收的钱,输出最少花的钱。

输入描述 Input Description

参见样例

输出描述 Output Description

参见样例

样例输入 Sample Input

样例输入:

4              //四个地点a,b,c,d

3 3 2 2     //3种方法分别是3元,2元,2元,下同

3 100 50 50

1 10000

2 30000 50

样例输出 Sample Output

样例输出:10102

#include<cstdio>
#include<cmath>
#include<cstring>
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
long long int a;
long long int n,m,minn;
long long int tot;
int main()
{
    ios::sync_with_stdio(false);
    cin>>n;
    for(int i=0;i<n;i++)
    {
        minn=99999999999;
        cin>>m;
        for(int j=0;j<m;j++)
        {
            cin>>a;
            if(minn>a)
                minn=a;
        }
        tot+=minn;
    }
    cout<<tot;
    return 0;
}
/*
4
3 3 2 2
3 100 50 50
1 10000
2 30000 50
*/
原文地址:https://www.cnblogs.com/kuaileyongheng/p/6710984.html