题目链接: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)的更多相关文章

  1. hdu 1263 水果 【二维map】

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

  2. hdu 1263 水果 (嵌套 map)

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

  3. HDU 1263 水果 (STL map)

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

  4. 题解报告:hdu 1263 水果

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

  5. hdu 1263 水果 结构的排序+sort自定义排序

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

  6. hdu 1263 水果

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

  7. HDU 1263(水果统计 **)

    题意是对水果的产地和种类进行统计再按格式输出. 代码如下: #include <bits/stdc++.h> using namespace std; struct node { ],pl ...

  8. HDU 1263 水果 结构体排序

    解题报告:一个结构体排序的题,用了一个运算符重载,要注意的是不同的地方可能会产相同的水果,一开始没注意. #include<cstdio> #include<cstring> ...

  9. STL || HDU 1263 水果

    map可以映射map…… 然后在map里面会自己排序 惊了 注意输出格式 回车的输出 #include <iostream> #include <cstdio> #includ ...

随机推荐

  1. HDU 6124 Euler theorem

    Euler theorem 思路:找规律 a       余数                  个数 1       0 1                     2 2       0 2   ...

  2. Phonetics: Lecture Three 语音 第三课 Teacher:Patrick

    元音字母: [u]   put [pʊt]  push [pʊʃ]  full [fʊl]  sugar ['ʃʊgɚ]  cook [kʊk]  look [lʊk]   took [tʊk] (v ...

  3. LeetCode--088--合并两个有序数组

    方法1: class Solution(object): def merge(self, nums1, m, nums2, n): """ :type nums1: Li ...

  4. Linux中su、su -和sudo的区别

    su 切换到root用户,但是并没有转到root用户家目录下,即没有改变用户的环境. su - 切换到root用户,并转到root用户的家目录下,即改变到了root用户的环境. 这个涉及到不同用户下的 ...

  5. Cron\CronExpression::setPart("24")

    利用laravle实现定时器的功能的时候,报错说:Cron\CronExpression::setPart("24"). 后来发现是时间设置的问题,他不能设置("24:0 ...

  6. 从0开始接触html--第一天学习内容总结

    第一天 总结: h1-h6 p 段落 hr br 有序 ol li 无序 ul li 定义列表 dl dt dd 块级元素:独占一行,h1-h6 p hr div 行内元素:共占一行, em和i st ...

  7. linux tcpdump 抓包

    tcpdump是linux命令行下常用的的一个抓包工具,记录一下平时常用的方式,测试机器系统是ubuntu 12.04. tcpdump的命令格式 tcpdump的参数众多,通过man tcpdump ...

  8. 简话Angular 05 Angular表单验证

    一句话: 可以使用所有html5表单验证功能,同时Angular还增强了部分验证,支持动态验证 1. 上源码 <div ng-controller="ExampleController ...

  9. forget word out2

      1★ dictionary / dik ʃ ən əri   dict   2★ fy => faction f æk ʃ ən 派别  

  10. PHP:第四章——PHP数组array_intersect计算数组交集

    <pre> <?php //array_intersect计算数组交集 header("Content-Type:text/html;charset=utf-8" ...