HDU 1263 水果(map或结构体排序)
来源:互联网 发布:人工智能利大于弊 编辑:程序博客网 时间:2024/05/01 07:10
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1263
思路:可以直接结构体快排,也可以用map(强大的STL)
#include <cstdio>#include <cmath>#include <iostream>#include <algorithm>#include <string>#include <cstring>#include <stdlib.h>#include <map>#include <set>#include <stack>#include <queue>#include <iterator>#include <ctype.h>using namespace std;int main(){ int n; scanf("%d", &n); while(n--) { map <string, map<string, int> > a; map <string, int> b; map<string, map<string, int> >:: iterator i; map<string, int>:: iterator j; int m; scanf("%d", &m); string name, palce; int num; while(m--) { cin >> name >> palce >> num; a[palce][name] += num; } for(i = a.begin(); i != a.end(); i++) { cout << i -> first << endl; b = i -> second; for(j = b.begin(); j != b.end(); j++) { cout << " |----" << j -> first << "(" << j -> second << ")" << endl; } } if(n) cout << endl; } return 0;}
0 0
- HDU 1263 水果(map或结构体排序)
- HDU 1263 水果(结构体排序)
- hdu 1263 水果【二维map+排序】
- hdu 1263 水果(map)
- hdu 1263 水果(map)
- hdu 1263 水果(map)
- HDU--杭电--1263--水果--结构体排序
- (结构体排序)水果
- HDU 1263 水果 map
- hdu 水果(map)
- hdu 1263 水果 (二维map)
- hdoj 水果 1263 (结构体排序)
- hdu1263 水果(结构体排序)
- HDU 1263 水果 map容器
- HDU-1263 水果(STL:map)
- hdu 1263 水果 sort对结构体中字符串二级排序
- hdu 1263 水果(map的使用2)
- HDU--1263--水果(map迭代使用)
- javaEE javabean
- file结构体中private_data指针的疑惑
- mybatis使用小贴士
- linux系统常用命令
- 模板方法模式
- HDU 1263 水果(map或结构体排序)
- MyEclipse14主题配色
- Angular.js Unknown provider 错误
- Makefile中自定义变量
- iOS中的block和retain cycle (经典)
- vsftpd匿名用户新建目录错误信息:550 Create directory operation failed
- MinGW在Win7下的按装、设置和使用,出现error: SDKDDKVer.h: No such file or directory
- 2014百度之星第二题Disk Schedule(双调欧几里得旅行商问题+DP)
- http://acm.hdu.edu.cn/showproblem.php?pid=3336