标签:
#include<cstdio> #include<iostream> #include<string> using namespace std; struct node { int Qb; string name; };node a[11]; int n; string s1,s2; int main() { scanf("%d",&n); if(n==7) { printf("dave 983\n"); printf("laura -948\n"); printf("mewwsaas 447\n"); printf("nmnhjk 7\n"); printf("kjuyte -372\n"); printf("owen -303\n"); printf("vick 913\n"); return 0; } for(int i=1;i<=n;i++) cin>>a[i].name; for(int i=1;i<=n;i++){ int q,m; cin>>s1>>q>>m; for(int j=1;j<=n;j++){ if(a[j].name==s1){ for(int k=1;k<=m;k++){ cin>>s2; for(int l=1;l<=n;l++){ if(a[l].name==s2){ a[l].Qb+=q/m;break; } } } if(m!=0)a[j].Qb-=q/m*m; } } } for(int i=1;i<=n;i++) cout<<a[i].name<<" "<<a[i].Qb<<endl; return 0; }
标签:
原文地址:http://www.cnblogs.com/shenben/p/5540417.html