STL || HDU 1263 水果
map可以映射map……
然后在map里面会自己排序
惊了
注意输出格式 回车的输出
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <queue>
#include <algorithm>
#include <string>
#include <map>
using namespace std;
map<string, map<string, int> > mp;
int main()
{
int T;
cin >> T;
while(T--)
{
int n;
cin >> n;
mp.clear();
string place, fruit;
int num;
for(int i = ; i < n; i++)
{
cin >> fruit >> place >> num;
mp[place][fruit] += num;
}
for(map<string, map<string, int> >::iterator iter1 = mp.begin(); iter1 != mp.end(); iter1++)
{
cout << iter1 -> first << endl;
for(map<string, int>::iterator iter2 = iter1->second.begin(); iter2 != iter1->second.end(); iter2++)
{
cout << " |----" << iter2->first << "(" << iter2->second << ")" << endl;
}
}
if(T) cout << endl;
}
return ;
}
STL || HDU 1263 水果的更多相关文章
- HDU 1263 水果 (STL map)
水果 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submissi ...
- hdu 1263 水果 【二维map】
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1263 题目大意: Problem Description 夏天来了~~好开心啊,呵呵,好多好多水果~~ ...
- 题解报告:hdu 1263 水果
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1263 Problem Description 夏天来了~~好开心啊,呵呵,好多好多水果~~ Joe经营 ...
- hdu 1263 水果
Problem Description 夏天来了~~好开心啊,呵呵,好多好多水果~~ Joe经营着一个不大的水果店.他认为生存之道就是经营最受顾客欢迎的水果.现在他想要一份水果销售情况的明细表,这样J ...
- HDU 1263(水果统计 **)
题意是对水果的产地和种类进行统计再按格式输出. 代码如下: #include <bits/stdc++.h> using namespace std; struct node { ],pl ...
- hdu 1263 水果 结构的排序+sort自定义排序
水果 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submissi ...
- HDU 1263 水果 结构体排序
解题报告:一个结构体排序的题,用了一个运算符重载,要注意的是不同的地方可能会产相同的水果,一开始没注意. #include<cstdio> #include<cstring> ...
- hdu 1263 水果 (嵌套 map)
水果Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submissio ...
- ACM 水果 hdu 1263 一题多解
题目:http://acm.hdu.edu.cn/showproblem.php?pid=1263 文章末有相应的一些测试数据供参考. 传统的数组解题方式 思路一: 三种属性的数据放在一个结构体里面, ...
随机推荐
- printf(“%06d\n”,x);
%06d : %是格式化输入接受参数的标记 0格式化命令:结果将用零来填充 6:填充位数 d:代表十进制 数据 printf(“%06d\n”,x); console: 000001 000002 0 ...
- 【社群话题分享】LAMP 还是 LNMP 或者 ?
每周三下午的话题活动是又拍云技术社群的优良传统- 大家一起来看看这周都聊了些啥吧- 往期话题推荐: [社群话题分享]Linux 各大发行版你怎么选? [社群话题分享]数据权限该怎么放? [社群话题分享 ...
- git自动化部署+rsync文件同步
1.进入线上git裸仓库 2.编辑post-receive #!/bin/sh unset GIT_DIR cd /var/www/ git pull http://web:xxxxxxx@120.3 ...
- Fiddler抓取HTTPS设置
做App测试,用Fiddler进行抓包,以下操作记录如何用手机进行设置使其可以捕捉HTTPS协议. 一.电脑端设置 1.手机和电脑保持统一局域网内 2.配置fiddler允许监听到https 打开Fi ...
- Codeforces Round #402 (Div. 2) C
Description Igor found out discounts in a shop and decided to buy n items. Discounts at the store wi ...
- compose 函数实现
总结componse函数实现过程 大致特点 参数均为函数, 返回值也是函数 第一函数接受参数, 其他函数接受的上一个函数的返回值 第一个函数的参数是多元的, 其他函数的一元的 自右向左执行 简单实现 ...
- PHP获取今天开始和结束的时间戳、每周开始结束的时间戳、每月开始结束的时间戳
PHP获取今天内的时间 今天开始和结束的时间戳 $t = time(); $start = mktime(0,0,0,date("m",$t),date("d" ...
- dubbo中Hessian方法重载问题处理
dubbo中Hessian方法重载,报出如下错误信息: 十一月 , :: 下午 org.apache.catalina.core.StandardWrapperValve invoke 严重: Ser ...
- SPRING-BOOT系列之SpringBoot的诞生及其和微服务的关系
转载自 : https://www.cnblogs.com/ityouknow/p/9034377.html 微服务架构 微服务的诞生并非偶然,它是在互联网高速发展,技术日新月异的变化以及传统架构无法 ...
- SpringMVC和MyBatis的整合
这里我们需要用到一个关键的jar包——Spring-MyBatis,它会帮你将MyBatis代码无缝地整合到Spring中.具体可以参考http://www.mybatis.org/spring/zh ...