题目链接: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. 10.Spring集成一

    1.Email 电子邮件工作原理: 邮件发送方通过邮件发送客户端把邮件发送到发送方的邮件服务器,在发送的过程中需要用到SMTP协议发送方的邮件服务器把邮件发送到接收方的邮件服务器,使用的协议也是SMT ...

  2. [2019BUAA软工]第一次团队作业

    Team V1 团队启动   BUAA Team V1 于2019年3月正式成立,将开始为期四个月的合作. 队员介绍 Name Summary Sefie wxmwy V1-bug制造公司资深工程师精 ...

  3. 练习五十三:for循环练习

    对100以内的两位数,请使用一个两重循环打印出所有十位数都比各位数字小的数,并统计个数 l = [] for i in range(1,9): for j in range(i): l.append( ...

  4. java——时间复杂度、动态数组

    O(n)不一定小于O(n^2),要具体来看,而我们说的这种时间复杂度其实是渐进时间复杂度,描述的是n趋近于无穷的情况. 动态数组的时间复杂度: 添加操作:O(n) addLast()的均摊复杂度为O( ...

  5. gitlab 的安装、汉化、卸载

    新机 dell服务器 2核4G 官网: https://about.gitlab.com/install/ 1.本次安装选择版本v10.8.4 wget https://mirrors.tuna.ts ...

  6. 转 Python3 错误和异常/ Python学习之错误调试和测试

    ########sample 0 https://www.cnblogs.com/Simon-xm/p/4073028.html except: #捕获所有异常 except: <异常名> ...

  7. [转]LazyLoad.js及scrollLoading.js

    本文转自:http://blog.csdn.net/ning109314/article/details/7042829 目前图片延迟加载主要分两大块,一是触发加载(根据滚动条位置加载图片):二是自动 ...

  8. spring boot基本认识

    大家眼中的spring boot:https://www.zhihu.com/question/39483566-------------------------------------------- ...

  9. 【转】Android事件分发机制完全解析,带你从源码的角度彻底理解(下)

    转载请注明出处:http://blog.csdn.net/guolin_blog/article/details/9153761 记得在前面的文章中,我带大家一起从源码的角度分析了Android中Vi ...

  10. Unity C# 使用JsonUtility读写Json文件

    本文原创,转载请注明出处:http://www.cnblogs.com/AdvancePikachu/p/7146731.html 今天,为大家分享一下unity上的Json序列化,应该一说到这个词语 ...