Map的嵌套,HDU(1263)
题目链接: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)的更多相关文章
- map的嵌套 + 例题(水果)
水果 http://acm.hdu.edu.cn/showproblem.php?pid=1263 Problem Description 夏天来了~~好开心啊,呵呵,好多好多水果~~Joe经营着一个 ...
- Map的嵌套 练习
Map的嵌套 练习 利用迭代和增强for循环的两种方式实现如下效果 package cn.ccc; import java.util.HashMap;import java.util.Iterat ...
- 水果(map的嵌套)
夏天来了~~好开心啊,呵呵,好多好多水果~~ Joe经营着一个不大的水果店.他认为生存之道就是经营最受顾客欢迎的水果.现在他想要一份水果销售情况的明细表,这样Joe就可以很容易掌握所有水果的销售情况了 ...
- 双列集合Map的嵌套遍历
双列集合Map的嵌套使用,例如HashMap中还有一个HashMap,这样的集合遍历起来稍微有点儿复杂.例如一个集合:HashMap<Integer,HashMap<String,Inte ...
- hdu 1263 水果 (嵌套 map)
水果Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submissio ...
- hdu 1263 水果 【二维map】
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1263 题目大意: Problem Description 夏天来了~~好开心啊,呵呵,好多好多水果~~ ...
- HDU 1263:水果(map)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1263 #include <stdio.h> #include <string.h&g ...
- HDU 1263 二维map
题意:给出一份水果的交易表,根据地区统计出水果的交易情况. 思路:二维map使用. #include<cstdio> #include<string> #include ...
- HDU 1263 水果 (STL map)
水果 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submissi ...
随机推荐
- oracle数据库的备份与还原
转自:https://www.cnblogs.com/ylldbk/p/5613365.html 数据导出: 1 将数据库TEST完全导出,用户名system 密码manager 导出到D:\daoc ...
- 大型分布式java应用与SOA
1.基于消息方式.远程调用方式的架构带来的问题: 1.1 系统多元化的问题 [解决]: 对共用逻辑部分进行抽象: 1.2 系统访问量.数据量上涨后带来的问题 [解决]: 拆分系统: 1.3 在构建共用 ...
- input校验不能以0开头的数字
不以零开头 <input type="text" class="form-control" onkeyup="value=value.rep ...
- Python数据操作
列表操作 保存matrix或者保存ndarray 数据类型转换 读取CSV某列 numpy数组写入到csv pandas to_csv 最左边 多一列 的问题 DataFrame对象操作
- Win10磁盘占用率过高
打开服务 禁用Superfetch 禁用Windows Search 禁用Connected User Experiences and Telemetry 禁用Windows Update[恢复选项卡 ...
- impdp参数TABLE_EXISTS_ACTION
[转自:http://space.itpub.net/519536/viewspace-631445] 当使用IMPDP完成数据库导入时,如遇到表已存在时,Oracle提供给我们如下四种处理方式:a. ...
- Java基础15-数组实例学生管理系统
import java.util.Scanner; public class Student{ public static void main(String[] args){ Scanner in=n ...
- [原创]hibernate更新后jdbc读取不到数据问题
最近在做工作流插件时使用的是自己基于hibernate连接封装的orm框架,按说跟hibernate共用的一个连接,应该在同一个事务中,但在使用时hibernate saveOrUpdate后(未提交 ...
- windows无法通过installer安装SVN
1.当你的电脑是windows xp操作系统的时候在安装TortoiseSVN1.8**版本的时候会出现如下问题造成不能完成安装: 出现“无法通过windowsinstaller服务安装此安装程序包. ...
- POJ 2112—— Optimal Milking——————【多重匹配、二分枚举答案、floyd预处理】
Optimal Milking Time Limit:2000MS Memory Limit:30000KB 64bit IO Format:%I64d & %I64u Sub ...