PKU 2153
2009-09-08 15:04
204 查看
#pragma warning (disable:4786)
#include <map>
#include <string>
#include <iostream>
#include <algorithm>
using namespace std;
typedef struct node
node stu[10000];
int main()
{
int i,num1,num2,score;
scanf("%d",&num2);
getchar();
num1=num2;
char str[32];
map<string,int> stu;
map<string,int>::iterator p;
while(num2--)
{
gets(str);
stu[str]=0;
}
scanf("%d",&num2);
while(num2--)
{
for(i=0;i<num1;i++)
{
scanf("%d",&score);
getchar();
gets(str);
stu[str]+=score;
}
int rank=1;
int temp=stu["Li Ming"];
for(p=stu.begin();p!=stu.end();p++)
{
if(p->second>temp)
rank++;
}
printf("%d\n",rank);
}
return 0;
}
#include <map>
#include <string>
#include <iostream>
#include <algorithm>
using namespace std;
typedef struct node
node stu[10000];
int main()
{
int i,num1,num2,score;
scanf("%d",&num2);
getchar();
num1=num2;
char str[32];
map<string,int> stu;
map<string,int>::iterator p;
while(num2--)
{
gets(str);
stu[str]=0;
}
scanf("%d",&num2);
while(num2--)
{
for(i=0;i<num1;i++)
{
scanf("%d",&score);
getchar();
gets(str);
stu[str]+=score;
}
int rank=1;
int temp=stu["Li Ming"];
for(p=stu.begin();p!=stu.end();p++)
{
if(p->second>temp)
rank++;
}
printf("%d\n",rank);
}
return 0;
}
相关文章推荐
- pku2153 Rank List
- pku 2153 Rank List
- pku2886 Who Gets the Most Candies?(线段树+反素数打表)
- pku acm 1065
- PKU ACM 1015 Jury Compromise (DP)
- POJ2104 K-th Number——划分树——pku2104
- ACM题目分类总结及pku题目分类
- POJ/PKU 2110
- pku1882 Stamps(http://poj.org/problem?id=1882)(博客搬迁)
- pku2351 Colored Sticks
- 线段树专辑 —— pku 2482 Stars in Your Window
- 最小风险——pku3045
- pku-1011-Sticks
- pku(poj) 1466 Girls and Boys (最大独立集)
- 最短路记录路径——PKU 2457
- pku 3117 pku 3352 割边以及双连通分量问题
- pku 2524 Ubiquitous Religions
- pku3678 Katu Puzzle
- pku1274 The Perfect Stall
- pku1325 Machine Schedule