标签:
#include<cstdio> #include<string> #include<map> #include<iostream> using namespace std; map<string,map<string,int> > m; map<string,map<string,int> >::iterator it; map<string,int>::iterator itt; int main() { int t,n,x; string f,place; scanf("%d",&t); while(t--) { scanf("%d",&n); m.clear(); for(int i=0;i<n;i++) { cin>>f>>place;scanf("%d",&x); m[place][f]+=x; } for(it=m.begin();it!=m.end();it++) { cout<<it->first<<endl; for(itt=it->second.begin();itt!=it->second.end();itt++) cout<<" |----"<<itt->first<<"("<<itt->second<<")"<<endl; } if(t) cout<<endl; } return 0; }
标签:
原文地址:http://www.cnblogs.com/LinesYao/p/5740895.html