#include <bits/stdc++.h> using namespace std; map<string,int>a; int main() { int n,many,m; cin>>n; string name[n],b[n],name_; for(int i = 0;i<n;i++){ cin>>name[i]; } for(int i = 0;i<n;i++){ cin>>name_>>many>>m; for(int j = 0;j<m;j++){ cin>>b[j]; a[b[j]] += many/m; } if(m!=0){ a[name_] -= many-many%m; } } for(int i = 0;i<n;i++){ cout<<name[i]<<" "<<a[name[i]]<<endl; } return 0; }
标签:std,name,int,many,互送,礼物 From: https://www.cnblogs.com/wangyihang-xh/p/17500118.html