杭电 HDU 1236 排名

排名

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)

Total Submission(s): 17116    Accepted Submission(s): 6167

Problem Description

今天的上机考试虽然有实时的Ranklist,但上面的排名只是根据完成的题数排序,没有考虑

每题的分值,所以并不是最后的排名。给定录取分数线,请你写程序找出最后通过分数线的

考生,并将他们的成绩按降序打印。

Input

测试输入包含若干场考试的信息。每场考试信息的第1行给出考生人数N ( 0 < N

< 1000 )、考题数M ( 0 < M < = 10 )、分数线(正整数)G;第2行排序给出第1题至第M题的正整数分值;以下N行,每行给出一

名考生的准考证号(长度不超过20的字符串)、该生解决的题目总数m、以及这m道题的题号

(题目号由1到M)。

当读入的考生人数为0时,输入结束,该场考试不予处理。

Output

对每场考试,首先在第1行输出不低于分数线的考生人数n,随后n行按分数从高

到低输出上线考生的考号与分数,其间用1空格分隔。若有多名考生分数相同,则按他们考

号的升序输出。

Sample Input

4 5 25
10 10 12 13 15
CS004 3 5 1 3
CS003 5 2 4 1 3 5
CS002 2 1 2
CS001 3 2 3 5
1 2 40
10 30
CS001 1 2
2 3 20
10 10 10
CS000000000000000001 0
CS000000000000000002 2 1 2
0

Sample Output

3
CS003 60
CS001 37
CS004 37
0
1
CS000000000000000002 20

Hint

Huge input, scanf is recommended.

 

挺简单 ,按照他说的来 就ok。注意某些数据类型

AC Code:


#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
struct person
{
	string str;
	int n;
	int t[11];//保存考试题号
	double score;
}per[1001];

bool cmp(person T,person A)
{
	if(T.score!=A.score)
		return T.score>A.score;
	else
		return T.str<A.str;
}

int main()
{
	int N,st;//st表示解决的题目总数
	double scline;//分数线
	while(cin>>N>>st>>scline,N)
	{
		for(int p=0;p<N;p++)//每次测试重置score
			per[p].score=0;
		double *persc=new double[10001];//记录每道题目的分值
	for(int i=1;i<=st;i++)
	{
		cin>>persc[i];
	}
	for(int j=0;j<N;j++)
	{
		cin>>per[j].str>>per[j].n;
	     for(int k=1;k<=per[j].n;k++)//表示输入结局的题号
			 cin>>per[j].t[k];
		 for(int q=1;q<=per[j].n;q++)

			 per[j].score+=persc[per[j].t[q]];
	}
	sort(per,per+N,cmp);
	int *temp=new int [1001];int x=0;//记录满足条件的结构对象
	for(int t=0;t<N;t++)
	{
		if(per[t].score>=scline)
			temp[x++]=t;
	}

	cout<<x<<endl;
	for(int g=0;g<x;g++)
	{
      	cout<<per[temp[g]].str<<" "<<per[temp[g]].score<<endl;

		}
	}
	return 0;
}
时间: 2024-10-05 23:56:28

杭电 HDU 1236 排名的相关文章

杭电 HDU 1164 Eddy&#39;s research I

Eddy's research I Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 7117    Accepted Submission(s): 4268 Problem Description Eddy's interest is very extensive, recently  he is interested in prime

杭电 HDU 1038 Biker&#39;s Trip Odometer

Biker's Trip Odometer Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 4745    Accepted Submission(s): 3144 Problem Description Most bicycle speedometers work by using a Hall Effect sensor faste

杭电 HDU 1098 Ignatius&#39;s puzzle

Ignatius's puzzle Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 7068    Accepted Submission(s): 4883 Problem Description Ignatius is poor at math,he falls across a puzzle problem,so he has no

杭电 HDU 1163 Eddy&#39;s digital Roots

Eddy's digital Roots Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 4904    Accepted Submission(s): 2743 Problem Description The digital root of a positive integer is found by summing the digi

杭电hdu 4861 Couple doubi

杭电 2014多校联训第一场   1001   Couple doubi   逗比夫妇 这标题我就不多说什么了. 题意:有K个球在桌上,每个球都有价值,第i个球的价值是1^i+2^i+...+(p-1)^i (mod p).其中p是一个素数,之后逗比男先选球,最后所有球总分高的获胜.如果逗比男获胜,那么输出“YES”否则输出“NO”.(逗比男和逗比女都采取最有策略). 当然这也p是奇素数的一个重要公式.曾有题是这个公式求和.当然如果你知道就很简单了.如果不知道,就打表找规律吧. 根据这一重要的公

杭电 HDU 1037 Keep on Truckin&#39;

Keep on Truckin' Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 9881    Accepted Submission(s): 6859 Problem Description Boudreaux and Thibodeaux are on the road again . . . "Boudreaux, we hav

hdu 1236 排名

http://acm.hdu.edu.cn/showproblem.php?pid=1236 自己写的comp,终于勉强算是掌握sort()了...囧...继续努力~ 1 #include<stdio.h> 2 #include<string.h> 3 #include<algorithm> 4 using namespace std; 5 struct St 6 { 7 char s[30]; 8 int sum,p; 9 }; 10 bool comp(struct

杭电 HDU ACM 1397 Goldbach&#39;s Conjecture

Goldbach's Conjecture Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 4976    Accepted Submission(s): 1901 Problem Description Goldbach's Conjecture: For any even number n greater than or equal

杭电 HDU ACM 5186 zhx&#39;s submissions

zhx's submissions Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others) Total Submission(s): 1892    Accepted Submission(s): 507 Problem Description As one of the most powerful brushes, zhx submits a lot of code on many