#include <cstdio>
#include <iostream>
#include <string>
#include <map>
#include <algorithm>
using namespace std;
typedef map<string, map<string, int> > mapp;
int main()
{
int t, n, i, k;
string fruit, place;
mapp a;
mapp::iterator ite;
map<string, int>::iterator jte;
cin>>t;
while(t--){
cin>>n;
for(i=0; i<n; i++){
cin>>fruit>>place>>k;
a[place][fruit] += k;
}
for(ite=a.begin(); ite!=a.end(); ite++){
cout<<ite->first<<endl;
for(jte=(ite->second).begin(); jte!=(ite->second).end(); jte++){
cout<<" |----"<<jte->first<<'('<<jte->second<<')'<<endl;
}
}
a.clear();
if(t!=0) cout<<endl;
}
return 0;
}
hdu 1263 水果
最新推荐文章于 2021-08-23 15:42:08 发布