【模拟】HDU4147KFC -Z+W

来源:互联网 发布:淘宝被挤爆了图片 编辑:程序博客网 时间:2024/05/17 02:44

题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4147

#include<bits/stdc++.h>#define INF 1<<29;using namespace std;int main(){int n,b,d,f,F;string s;cin.sync_with_stdio(false);while(cin>>n>>b>>d>>f>>F){int A=b+d+f;int B=(b+d)*2+F;int C=(b+d)*3+2*F;int ans=INF;for(int i=0;i<n;i++){cin>>s;int sum=0;for(int i=0;i<s.size();i++){if(s[i]=='A') sum+=A;else if(s[i]=='B') sum+=B;else if(s[i]=='C') sum+=C;}if(ans>sum) ans=sum;}cout<<ans<<endl;}return 0;}


原创粉丝点击