HDU 1263:水果(map)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1263
#include <stdio.h>
#include <string.h>
#include <iostream>
#include <algorithm>
#include <math.h>
#include <limits.h>
#include <map>
#include <stack>
#include <queue>
#include <vector>
#include <set>
#include <string>
#define ll long long
#define ms(a) memset(a,0,sizeof(a))
#define pi acos(-1.0)
#define INF 0x3f3f3f3f
const double E=exp(1);
const int maxn=1e6+10;
using namespace std;
int main(int argc, char const *argv[])
{
ios::sync_with_stdio(false);
int t,n;
cin>>t;
while(t--)
{
string place;
string fruit;
int num;
map<string,map<string,int> >mmp;
cin>>n;
for(int i=0;i<n;i++)
{
cin>>fruit>>place>>num;
mmp[place][fruit]+=num;
}
map<string,map<string,int> >::iterator it;
for(it=mmp.begin();it!=mmp.end();it++)
{
cout<<it->first<<endl;
map<string,int>::iterator its;
for(its=it->second.begin();its!=it->second.end();its++)
{
cout<<" |----"<<its->first<<"("<<its->second<<")"<<endl;
}
}
//注意最后一组数结尾没空行
if(t)
cout<<endl;
}
return 0;
}
HDU 1263:水果(map)的更多相关文章
- hdu 1263 水果 【二维map】
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1263 题目大意: Problem Description 夏天来了~~好开心啊,呵呵,好多好多水果~~ ...
- hdu 1263 水果 (嵌套 map)
水果Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submissio ...
- HDU 1263 水果 (STL map)
水果 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submissi ...
- 题解报告:hdu 1263 水果
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1263 Problem Description 夏天来了~~好开心啊,呵呵,好多好多水果~~ Joe经营 ...
- hdu 1263 水果 结构的排序+sort自定义排序
水果 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submissi ...
- hdu 1263 水果
Problem Description 夏天来了~~好开心啊,呵呵,好多好多水果~~ Joe经营着一个不大的水果店.他认为生存之道就是经营最受顾客欢迎的水果.现在他想要一份水果销售情况的明细表,这样J ...
- HDU 1263(水果统计 **)
题意是对水果的产地和种类进行统计再按格式输出. 代码如下: #include <bits/stdc++.h> using namespace std; struct node { ],pl ...
- HDU 1263 水果 结构体排序
解题报告:一个结构体排序的题,用了一个运算符重载,要注意的是不同的地方可能会产相同的水果,一开始没注意. #include<cstdio> #include<cstring> ...
- STL || HDU 1263 水果
map可以映射map…… 然后在map里面会自己排序 惊了 注意输出格式 回车的输出 #include <iostream> #include <cstdio> #includ ...
随机推荐
- tp3.x和tp 5的区别
由于TP5.0是一个全新的颠覆重构版本,所以现在面试很多面试官喜欢问TP3.2和TP5之间的区别,那他们之间到底有哪些区别呢?一.目录 TP5目录 二.需要摒弃的 3.X 旧思想 模型的变动 ...
- codeforces 1042c// Array Product// Codeforces Round #510(Div. 2)
题意:给出一个数组,2种操作:.1:x*y然后x消失,2:除掉x(2操作最多只能进行一次).问最大的结果的一种操作方式.逻辑题,看能不能想全面. 1先数好0,正,负的数量,zero,pos,neg.如 ...
- Confluence 6 选项 1 – 在 Confluence 中手动重建用户和用户组
当你只有少量的用户和用户组的时候,使用这个方法. 使用 Confluence 的系统管理员登录 Confluence. 进入用户目录管理界面,然后移动 内部目录(internal directory) ...
- Anton and School - 2 CodeForces - 785D (组合计数,括号匹配)
大意: 给定括号字符串, 求多少个子序列是RSGS. RSGS定义如下: It is not empty (that is n ≠ 0). The length of the sequence is ...
- Oracle性能诊断艺术-读书笔记(执行计划中显示 Starts, E-Rows, REM A-Rows and A-Time)等)
必须以 ' runstats_last '的方式查看执行计划哦! 操作一 hint /*+ gather_plan_statistics */ : /* 添加 hint /*+ gather_ ...
- 进程通信方式-管道pipe
管道是两个进程间进行单向通信的机制.因为管道传递数据的单向性,管道又称之为半双工管道. 1.数据只能从一个进程流向另一个进程(其中一个写管道,另一个读管道):如果要进行全双工通信,需要建立两个管道. ...
- kill prefix hemi hexa hepta holo input 1
1● hemi 0.5 2● hexa 6 3● hepta 7 4● holo 100%
- Python gui编程pyQt5安装步骤t
Python gui编程pyQt5安装步骤 pip install PyQt5 Pip3 install PyQt5 https://riverbankco ...
- PHP:第三章——PHP中表达式函数和匿名函数
<?php header("Content-Type:text/html;charset=utf-8"); //表达式函数和匿名函数 /*$A=function(){ ech ...
- sha256 in C language
sha256.h #ifndef _SHA256_H#define _SHA256_H #ifndef uint8#define uint8 unsigned char#endif #ifndef u ...