题目链接: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. Codeforces 832C - Strange Radiation

    832C - Strange Radiation 思路:二分最短时间. 代码: #include<bits/stdc++.h> using namespace std; #define l ...

  2. domContentload和onload

    defer和async <script src="script.js"></script> 没有 defer 或 async,浏览器会立即加载并执行指定的脚 ...

  3. linux系统方面的知识

      1.什么是Linux? 组成部分:硬件.内核.lib库.应用程序   硬件:工作中真正工作的组成部分是硬件   linux内核(kernel):管理硬件 Linux团队管理的版本   lib库:封 ...

  4. Necklace CodeForces - 613C (构造)

    链接 大意: 给定n种珠子, 第i种有$a_i$个, 求将珠子穿成项链, 使得能使切开后的项链回文的切口尽量多 若有一种以上珠子为奇数, 显然不能为回文, 否则最大值一定是$gcd(a_1,a_2,. ...

  5. Hololens 开发环境配置(转)

    转自 Vangos Pterneas, 4 Apr 2016 CPOL 5.00 (1 vote) vote 1vote 2vote 3vote 4vote 5 The past few days h ...

  6. 数据库到jsp页面报错(一)

    数据库到jsp页面报错(一) 这个错误的确比较坑. 控制台:     页面: 解决: 神坑啊!!!

  7. BZOJ1197 [HNOI2006]花仙子的魔法

    其实是一道奇怪的DP题,蒟蒻又不会做... 看了Vfk的题解才算弄明白是怎么一回事: 令f[i, j]表示i维有j个球时最大切割部分,则 f[i, j] = f[i, j - 1] + f[i - 1 ...

  8. 在mvc中弹出提示框

    在传统的WebForm中,我们要弹出一个alert提示框非常简单,只要在页面中输出alert即可,比如输出: Response.Write("<script >alrer('我是 ...

  9. zabbix的搭建与入门

    一,Zabbix架构 zabbix 是一个基于 WEB 界面的提供分布式系统监视以及网络监视功能的企业级的开源解决方案.zabbix 能监视各种网络参数,保证服务器系统的安全运营:并提供灵活的通知机制 ...

  10. struts2 实现rest

    参考链接https://www.ibm.com/developerworks/cn/java/j-lo-struts2rest/