题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1263

新学的map的嵌套

#include <stdio.h>
#include <map>
#include <string>
#include <iostream>
#include <algorithm> using namespace std; int main()
{
int t;
scanf("%d",&t);
while(t--)
{
int order;
scanf("%d",&order); map<string,map<string,int> > maps; string name,place;
int num; while(order--)
{
cin>>name>>place>>num;
maps[place][name]+=num;
} map<string,map<string,int>,> ::iterator pos; for(pos=maps.begin();pos!=maps.end();pos++)
{
cout<<pos->first<<endl;
map<string,int> ::iterator pos2; for(pos2=pos->second.begin();pos2!=pos->second.end();pos2++)
{
cout<<" |----"<<pos2->first<<"("<<pos2->second<<")"<<endl;
} }
if(t)
cout<<endl;
}
return ;
}

Map的嵌套,HDU(1263)的更多相关文章

  1. map的嵌套 + 例题(水果)

    水果 http://acm.hdu.edu.cn/showproblem.php?pid=1263 Problem Description 夏天来了~~好开心啊,呵呵,好多好多水果~~Joe经营着一个 ...

  2. Map的嵌套 练习

    Map的嵌套   练习 利用迭代和增强for循环的两种方式实现如下效果 package cn.ccc; import java.util.HashMap;import java.util.Iterat ...

  3. 水果(map的嵌套)

    夏天来了~~好开心啊,呵呵,好多好多水果~~ Joe经营着一个不大的水果店.他认为生存之道就是经营最受顾客欢迎的水果.现在他想要一份水果销售情况的明细表,这样Joe就可以很容易掌握所有水果的销售情况了 ...

  4. 双列集合Map的嵌套遍历

    双列集合Map的嵌套使用,例如HashMap中还有一个HashMap,这样的集合遍历起来稍微有点儿复杂.例如一个集合:HashMap<Integer,HashMap<String,Inte ...

  5. hdu 1263 水果 (嵌套 map)

    水果Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submissio ...

  6. hdu 1263 水果 【二维map】

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1263 题目大意: Problem Description 夏天来了~~好开心啊,呵呵,好多好多水果~~ ...

  7. HDU 1263:水果(map)

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1263 #include <stdio.h> #include <string.h&g ...

  8. HDU 1263 二维map

    题意:给出一份水果的交易表,根据地区统计出水果的交易情况.   思路:二维map使用.   #include<cstdio> #include<string> #include ...

  9. HDU 1263 水果 (STL map)

    水果 Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submissi ...

随机推荐

  1. spring boot http2

    项目已启动的情况下,启动单元测试报端口has binded 可以使用server.port=-1 禁用端口绑定来启动单元测试 https://docs.spring.io/spring-boot/do ...

  2. django DRF 图片路径问题

    问题描述:为什么DRF中有时候返回的json中图片是带域名的,有时候是不带域名的呢?(难受啊马飞~) 解答:带域名的结果是在view中对模型类序列化的,DRF在序列化图片的时候 会检查上下文有没有re ...

  3. 文献综述一:基于UML技术的商品管理系统设计与实现

    一.基本信息 标题:基于UML技术的商品管理系统设计与实现 时间:2018 出版源:福建电脑 文件分类:uml技术的研究 二.研究背景 使用 UML 技术对商品管理系统进行了分析与研究,使用户对商品信 ...

  4. VS 开发中觉得不错的几款插件

    1.C# Outline 2013  {}折叠 2.Indent Guides:为缩进添加竖直线 3.ResXManager:多语言资源文件编辑 4.C# Formatter:代码清理 5.Highl ...

  5. python 实现连接mysql并读一条数据写到csv一条数据

    import MySQLdb as mdb import csv with open('my.csv', 'w+', newline='') as csv_file: writer = csv.wri ...

  6. Django 中orm的第一次举荐

    Django ORM :对象--关系--映射 创建Django准备工作: 1.在数据库创建你需要的数据库 2.在项目models里创建模型(就是python写的类,也可以说是python写的数据库) ...

  7. zuul路由网关

    zuul作为网关组件,主要用来管理api请求接口(统一对外暴露,负载均衡),身份认证,流量监控等.它是通过servlet来实现的,核心是一系列过滤器,可以在请求的发起跟相应返回阶段进行一系列的处理. ...

  8. 【Linux】Debian vim没有颜色的解决办法

    vim /etc/vim/vimrc   #查找到syntax on 启用,去掉前面的“ (引号). 保存ok 转载地址:http://www.th7.cn/system/lin/201404/525 ...

  9. Web.Config详细说明

    (一).Web.Config是以XML文件规范存储,配置文件分为以下格式 1.配置节处理程序声明    特点:位于配置文件的顶部,包含在<configSections>标志中. 2.特定应 ...

  10. 调用webservice

    WebClient web = new WebClient(); Stream stream = web.OpenRead(this._wsdlUrl); //Stream streamInfo = ...