您的位置:首页 > 其它

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;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: