| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
水题,却搞了这么久,还是STL不清楚啊,mapRT
#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>
using namespace std;
const int N = 10010;
int main()
{
int n;
while(scanf("%d",&n) != EOF)
{
string ss;
getchar();
map<string,int> mp;
map<string,int> :: iterator it;
for(int i = 0; i < n; ++i)
{
getline(cin,ss);
mp[ss] = 0;
}
int m;
scanf("%d", &m);
getchar();
for(int i = 0; i < m; ++i)
{
int value = 0,score = 0;
for(int j = 0; j < n; ++j)
{
scanf("%d",&score);
getchar();
getline(cin,ss);
mp[ss] += score;
if(ss == "Li Ming")
value = mp[ss];
}
int cnt = 0,num[N];
for(it = mp.begin(); it != mp.end(); ++it)
num[cnt++] = it -> second;
int ans = 0;
for(int k = 0; k < cnt; ++k)
{
if(num[k] > value)
ans++;
}
ans++;
printf("%d\n", ans);
}
}
return 0;
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator