国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 學院 > 開發設計 > 正文

PAT 1025

2019-11-08 02:23:58
字體:
來源:轉載
供稿:網友
#include<cstdio>#include<algorithm>#include<stdlib.h>#include<cstring>using namespace std;struct student{	char id[15];	int score;	int lonum;	int localrank;	int finalrank;}st[30010];bool cmp(student st1,student st2){	if(st1.score!=st2.score)			return st1.score>st2.score;	else		return strcmp(st1.id,st2.id)<0;}int main(){		int n;//考場數	scanf("%d",&n);	int k[105]={};//考場人數	int sum=0;//總人數	for(int i=1;i<=n;i++)	{		scanf("%d",&k[i]);				for(int j=sum;j<(k[i]+sum);j++)		{			scanf("%s %d",st[j].id,&st[j].score);			st[j].lonum=i;		}		sort(st+sum,st+sum+k[i],cmp);		st[sum].localrank=1;		for(int j=sum+1;j<(k[i]+sum);j++)		{			if(st[j].score==st[j-1].score)				st[j].localrank=st[j-1].localrank;			else					st[j].localrank=j-sum+1;		}		sum=k[i]+sum;	}	sort(st,st+sum,cmp);	st[0].finalrank=1;	for(int i=1;i<sum;i++)	{		if(st[i].score==st[i-1].score)				st[i].finalrank=st[i-1].finalrank;			else					st[i].finalrank=i+1;	}	PRintf("%d/n",sum);	for(int i=0;i<sum;i++)	{		printf("%s %d %d %d/n",st[i].id,st[i].finalrank,st[i].lonum,st[i].localrank);	}	system("pause");	return 0;}
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 金寨县| 廉江市| 竹山县| 时尚| 沾化县| 兴安盟| 富锦市| 南溪县| 和林格尔县| 横峰县| 阿克| 大足县| 景泰县| 水城县| 台山市| 邳州市| 房产| 政和县| 南靖县| 唐河县| 闸北区| 牟定县| 苍山县| 页游| 松阳县| 龙海市| 利川市| 灵石县| 新建县| 广汉市| 乌恰县| 房山区| 延边| 喀什市| 华亭县| 合川市| 夏邑县| 遵化市| 巧家县| 周口市| 霍城县|