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

首頁 > 學院 > 開發(fā)設(shè)計 > 正文

1075

2019-11-11 04:51:32
字體:
供稿:網(wǎng)友
#include<cstdio>#include<cstring>#include<iostream>#include<algorithm>using namespace std;struct User{	int id;	int pScore[6];	int totalScore;	bool valid;	int perfectPRoblem;	int rank;}user[10010];User temp[10010];bool cmp(User a, User b){	if (a.totalScore != b.totalScore)		return a.totalScore > b.totalScore;	else if (a.perfectProblem != b.perfectProblem)		return a.perfectProblem > b.perfectProblem;	else return a.id < b.id;		}void initial(){	for (int i = 0; i < 10010; i++){		for (int j = 1; j < 6; j++)			user[i].pScore[j] = -2;		user[i].totalScore = 0;		user[i].valid = false;		user[i].perfectProblem = 0;	}}int main(){	int n, k, m;	scanf("%d%d%d", &n, &k, &m);	initial();	int p[6];	for (int i = 1; i <= k; i++)		scanf("%d", &p[i]);	for (int i = 0; i < m; i++){		int useId,proId,patScore;		scanf("%d%d%d", &useId,&proId,&patScore);		user[useId].id = useId;		if(user[useId].pScore[proId] < patScore)			user[useId].pScore[proId] = patScore;		if (patScore != -1)			user[useId].valid = true;	}	int j = 0;	for (int i = 0; i < 10010; i++){		if (user[i].valid){			for (int x = 1; x <= k; x++){				if (user[i].pScore[x] != -2 && user[i].pScore[x] != -1)					user[i].totalScore += user[i].pScore[x];				if (user[i].pScore[x] == p[x])					user[i].perfectProblem++;			}			temp[j++] = user[i];		}	}	sort(temp, temp + j, cmp);	int Rank = 1;	for (int i = 0; i < j; i++){		if (i == 0 || temp[i].totalScore < temp[i - 1].totalScore)			temp[i].rank = Rank;		else			temp[i].rank = temp[i - 1].rank;		Rank++;		printf("%d %05d %d", temp[i].rank, temp[i].id, temp[i].totalScore);		for (int x = 1; x <= k; x++){			if (temp[i].pScore[x] == -1)				printf(" 0");			else if (temp[i].pScore[x] == -2)				printf(" -");			else				printf(" %d", temp[i].pScore[x]);		}		printf("/n");	}	return 0;}
發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表
主站蜘蛛池模板: 临安市| 五家渠市| 元谋县| 长白| 鄯善县| 恩施市| 张家港市| 鹿邑县| 罗甸县| 义乌市| 应用必备| 洱源县| 赞皇县| 河池市| 同心县| 海城市| 永安市| 建湖县| 仲巴县| 台中市| 斗六市| 车险| 夹江县| 宁津县| 元氏县| 比如县| 尉氏县| 吉木萨尔县| 贵溪市| 广平县| 安庆市| 广州市| 襄汾县| 威海市| 神木县| 弥渡县| 公安县| 宜城市| 尉犁县| 县级市| 黄梅县|