标签:end bool ++i ring false names make sign class
因为没做过hd的题所以输出格式爆炸
#include<bits/stdc++.h>
using namespace std;
int n;
int m;
map<pair<string,string>,int > mm;
int main()
{
cin >> n;
map<pair<string,string>,int >::iterator it;
string ts1,ts2;
int ti1;
bool sign = false;
while(n--)
{
cin >> m;
mm.clear();
for(int i=0;i<m;++i)
{
cin >> ts1 >> ts2 >> ti1;
mm[make_pair(ts2,ts1)] += ti1;
}
ts1 = mm.begin()->first.first;
cout <<ts1 ;
for(it = mm.begin();it!=mm.end();++it)
{
if(it->first.first==ts1)
{
cout <<endl<<" |----"<<it->first.second <<"("<<it->second << ")";
}
else
{
ts1 = it->first.first;
cout <<endl<< ts1;
cout <<endl<<" |----"<<it->first.second <<"("<<it->second << ")";
}
}
if(n) cout << endl<<endl;
else cout <<endl;
}
return 0;
}
标签:end bool ++i ring false names make sign class
原文地址:https://www.cnblogs.com/xxrlz/p/10380874.html