#include <iostream> #include <map> #include <bits/stdc++.h> using namespace std; map<string,int>name_mon; int main(int argc, char** argv) { string name[15],zname,pname; int n,mon,m; cin>>n; for(int i=0;i<n;i++){ cin>>name[i]; } for(int i=0;i<n;i++){ cin>>zname>>mon>>m; for(int j=0;j<m;j++){ cin>>pname; name_mon[pname]=name_mon[pname]+mon/m; } if(m!=0){ name_mon[zname]=name_mon[zname]-mon+mon%m; } } for(int i=0;i<n;i++){ cout<<name[i]<<" "<<name_mon[name[i]]<<endl; } return 0; }
标签:name,int,zname,pname,mon,送礼物,include From: https://www.cnblogs.com/wangyueshuo/p/17500108.html