标签:php nbsp ace arc 排列 嵌套 other padding bsp
http://acm.hdu.edu.cn/showproblem.php?pid=1263
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 12167 Accepted Submission(s): 4844
#include<iostream> #include<map> #include<string> using namespace std; map<string, map<string, int> > mp; //用嵌套。 int main(){ int T; scanf("%d",&T); while(T--){ mp.clear(); //注意要用clear()每次清空。 int n; scanf("%d",&n); while(n--){ string name,place; int num; cin>>name>>place>>num; mp[place][name] += num; } for(map<string, map<string, int> >::iterator it = mp.begin();it != mp.end(); it++){ printf("%s\n",it -> first.c_str()); // cout<<it -> first<<endl; for(map<string, int>::iterator it1 = it -> second.begin(); it1 != it -> second.end(); it1++){ printf(" |----%s(%d)\n",it1 -> first.c_str(),it1 -> second); // cout<<" "<<"|----"<<it1->first<<"("<<it1->second<<")"<<endl; } } if(T!=0){ printf("\n"); } } return 0; }
标签:php nbsp ace arc 排列 嵌套 other padding bsp
原文地址:https://www.cnblogs.com/Weixu-Liu/p/10327672.html