poj 2153 Rank List

#include <iostream>        //The rank is decided by the total scores. 分数要累加
#include <string>
#include
<map>
using namespace std;
int main()
{
int n,m,i;string name;
map
<string,int> score;
map
<string,int>::iterator pos;
scanf(
"%d\n",&n);
for(i=1;i<=n;++i)
{
getline(cin,name);
score[name]
=0;
}
scanf(
"%d",&m);
while(m--)
{
int data,p,amount=1;
for(i=0;i<n;++i)
{
scanf(
"%d ",&data);
getline(cin,name);
score[name]
+=data;
}
pos
=score.find("Li Ming");
p
=pos->second;
for(pos=score.begin();pos!=score.end();++pos)
{
if(pos->second>p)
amount
++;
}
printf(
"%d\n",amount);
}
return 0;
}

  

posted on 2011-07-20 22:47  sysu_mjc  阅读(106)  评论(0编辑  收藏  举报

导航