http://codeforces.com/contest/431/problem/A
简单题,题目意思看懂就行,
1234四个盒子,每个盒子一个数值,
给一组数据
求和
#include<iostream>
using namespace std;
int b[100080];char s[100080];
int main()
{
int a[4];
while(scanf("%d",&a[0])!=EOF)
{
for(int i=1;i<4;i++)
{
cin>>a[i];
}
cin>>s;int sum=0;
int len=strlen(s);
for(int i=0;i<len;i++)
{
sum=a[s[i]-'0'-1]+sum;
}
cout<<sum<<endl;
}
}