HDU1263-map
来源:互联网 发布:java jdbc学生管理 编辑:程序博客网 时间:2024/05/01 15:13
题目:题目链接
题意:题目的意思就是按照又产地到水果的次序,统计每一个产地不同水果的销售情况。用map的映射很强大,二维的
map使用:
#include <iostream>#include <cstdio>#include <string>#include <string.h>#include <map>#include <vector>#include <cstdlib>#include <algorithm>#include <cmath>#include <queue>#include <set>#include <stack>#include <functional>#include <fstream>#include <sstream>#include <iomanip>#include <numeric>#include <cassert>#include <bitset>#include <stack>#include <ctime>#include <list>#define INF 0x7fffffff#define max3(a,b,c) (max(a,b)>c?max(a,b):c)#define min3(a,b,c) (min(a,b)<c?min(a,b):c)#define mem(a,b) memset(a,b,sizeof(a))using namespace std;int t, n;int main(){ scanf("%d", &t); while(t--) { scanf("%d", &n); map<string, map<string, int> >mp; string place, name; int num; for(int i = 0; i < n; ++i) { cin >> name >> place >> num; mp[place][name] += 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 0;}
- HDU1263-map
- hdu1263(水果 map)
- hdu1263 二重map
- STL(map和二维map/hdu1263)
- hdu1263
- hdu1263水果 STL map的使用
- hdu1263水果(map容器的嵌套)
- hdu1263(结构体排序/二维map)
- hdu1263(map(自己定义的数据结构的map))
- hdu1004 Let the Balloon Rise && hdu1263 水果(map)
- 【HDU1263】【STL-MAP套MAP】(省份,水果,数量)MAP嵌套大开发
- HDU1263:水果
- hdu1263水果
- hdu1263水果
- hdu1263 水果
- HDU1263:水果
- hdu1263 水果
- 水果 hdu1263 水题
- Java:MD5 Hash
- 两个日期相差天数计算
- To 小伟
- javascript 闭包 变量释放GC 测试
- Oracle 级联约束
- HDU1263-map
- 金铜仙人辞汉歌-李贺
- 从“程序员转行卖烧饼”想到IT人创业
- 排序算法之归并排序
- Norm
- 《冬夜读书示子聿》 陆游
- 代码统计工具statsvn
- hdu 4473 Exam
- java时间自动转成今天、昨天、前天,如果是同一年刚显示月日,不同年的把年也显示