hdu 2648(map简单应用)
2014-05-26 17:59
387 查看
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2648
思路:map映射,记录一下memory的位置即可。
View Code
思路:map映射,记录一下memory的位置即可。
1 #include<iostream> 2 #include<cstdio> 3 #include<cstring> 4 #include<algorithm> 5 #include<map> 6 #include<string> 7 using namespace std; 8 int Point[10010]; 9 10 int main() { 11 int n,m,pos,price; 12 while(~scanf("%d",&n)) { 13 memset(Point,0,sizeof(Point)); 14 map<string,int>mp; 15 string str; 16 for(int i=0; i<n; i++) { 17 cin>>str; 18 if(str=="memory")pos=i; 19 mp[str]=i; 20 } 21 scanf("%d",&m); 22 while(m--) { 23 for(int k=1; k<=n; k++) { 24 scanf("%d",&price); 25 cin>>str; 26 Point[mp[str]]+=price; 27 } 28 int Rank=1; 29 for(int i=0; i<n; i++)if(Point[i]>Point[pos])Rank++; 30 printf("%d\n",Rank); 31 } 32 } 33 return 0; 34 }
View Code
相关文章推荐
- hdu 2648(map简单应用)
- STL_map简单应用(HDU_1075)
- hdu 4287 Intelligent IME map的简单应用
- HDU 1263 水果(map的简单应用)
- hdu 2072 单词数(map的简单应用)
- hdu-1247 简单map的应用。(字典树)
- HDU 2642 Stars 简单二维树状数组应用
- hdu 3874 Necklace【树状数组简单应用】
- hdu 3038 How Many Answers Are Wrong【并查集的简单应用】
- HDU--1232 -- 畅通工程 [并查集最简单应用]
- hdu 1754 简单的线段树应用
- hdu1098 数学归纳法简单应用
- hdu 1381 Crazy Search(hash/map的应用)
- hdu 3486 RMQ+二分 简单应用
- hdu 1541 Stars【树状数组简单应用】
- map容器简单应用
- hdu 1237 简单计算器 (栈的简单应用)
- hdu 2896(ac自动机简单应用)
- hdu 3038 How Many Answers Are Wrong【并查集的简单应用】
- STL模版库的vector,map的简单应用