标签:clear amp int cond 情况 cin 排版 can esc
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 10238 Accepted Submission(s): 4080
//#include "stdafx.h" #include<iostream> #include<cstdio> #include<string> #include<map> using namespace std; int main() { map<string, map<string, int> > p; map<string, int> q; map<string, map<string, int> >::iterator i;//迭代器 map<string, int>::iterator j; int n, t, m; string str1, str2; cin >> n; while(n--) { p.clear(); q.clear(); cin >> m; while(m--) { cin >> str1 >> str2 >> t; p[str1][str2] += t;//返回最外层str1对应的中间层map中str2对应的int } for (i = p.begin(); i != p.end(); i++) { cout << i->first<<endl; q = i->second; for (j = q.begin(); j != q.end(); j++) { cout << " |----" << j->first << "(" << j->second << ")"<<endl; } } if (n) cout << endl; } return 0; }
标签:clear amp int cond 情况 cin 排版 can esc
原文地址:https://www.cnblogs.com/XuYiting/p/9309379.html