#include <iostream>
#include <map>
using namespace std;
map<int,int> mp;
int n,m,k,x,cnt,flag,num;
double a[105];
double sum;
int main(){
cin>>n;
for(int i=1;i<=n;i++) cin>>a[i];
while(cin>>m&&m){
cin>>num;
mp[m]+=num;
}
for(int i=1;i<=n;i++){
cout<<mp[i]<<endl;
sum+=mp[i]*a[i];
}
printf("%.2lf",sum);
return 0;
}
PTA L1-102 兰州牛肉面
最新推荐文章于 2024-08-30 16:00:44 发布