nbuoj2780 旅游问题

题目:http://www.nbuoj.com/v8.83/Problems/Problem.php?pid=2780

题意:莫得题意

原以为是道究极蠢的贪心,但是被一发wa打脸,给上wa点,还是太年轻了/(ㄒoㄒ)/~~

Input
4 5
2 3 4 5
1 2 100
3 5 90
6 10 10
11 14 8
15 20 7
Expect
105
Output
112

#include<bits/stdc++.h>
using namespace std;
int n,m,a[200],b[200],c[200],x[200],ans=0,fee,res=0x3f3f3f3f;
int main()
{
    cin>>n>>m;
    for(int i=1;i<=n;i++)cin>>x[i],ans+=x[i];
    for(int i=1;i<=m;i++)
    {
        cin>>a[i]>>b[i]>>c[i];
        if(ans>=a[i])fee=c[i];
        else res=min(a[i]*c[i],res);
    }
    ans=ans*fee;
    cout<<min(ans,res)<<endl;
    
    return 0;
}

猜你喜欢

转载自www.cnblogs.com/myrtle/p/11861739.html