HDU
来源:互联网 发布:林弯弯的淘宝店地址 编辑:程序博客网 时间:2024/06/05 22:41
F - 水果
HDU - 1263
#include <iostream>#include <cstdio>#include <cstring>#include <set>#include <queue>#include <algorithm>#include <functional>#include <string>#include <map>using namespace std;const int maxn=100+5;const int inf=0x3f3f3f3f;int main(){ int n; scanf("%d",&n); while(n--) { map<string,map<string,int> > mp; int m=0; scanf("%d",&m); for(int i=0;i<m;i++) { string a,b; int temp=0; cin>>a>>b>>temp; mp[b][a]+=temp; } for(map<string,map<string,int> >::iterator it=mp.begin();it!=mp.end();it++) { cout<<it->first<<endl; map<string,int> &mpp=(*it).second;//用一个新的map做it->second的副本。 for(map<string,int>::iterator itt=mpp.begin();itt!=mpp.end();itt++) { cout<<" |----"<<(*itt).first; cout<<"("<<itt->second<<")"<<endl; } } if(n) printf("\n");//原因在于n--,而不是--n; }}
阅读全文
0 0
- hdu
- hdu
- HDU
- hdu ()
- hdu
- hdu
- HDU
- HDU
- hdu
- hdu
- HDU
- Hdu
- hdu
- hdu-
- hdu
- hdu
- hdu
- HDU
- super.onCreate(savedInstanceState)
- Android NDK 工具链的使用方法(Standalone Toolchain)
- mybatis(11)--动态sql
- React native的Error:Failed to crunch file D:\......background.9.png错误解决
- Dom4j解析和生成XML文档
- HDU
- lintcode--删除排序数组中的重复数字
- web前端清除浮动详解
- composer基本用法+构建php框架
- android数据传递之activity带返回值的跳转,模拟登陆注册
- 03-APACHE网站服务
- [leetcode]14. Longest Common Prefix(Java)
- photpshop e6安装
- 在Linux上找到所有已经打开的端口及其对应的进程