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

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

1075

2019-11-11 04:18:28
字體:
來源:轉載
供稿:網友
#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;}
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 凌源市| 灵石县| 甘孜县| 桂东县| 阿尔山市| 汾阳市| 明星| 定结县| 大埔县| 巢湖市| 土默特左旗| 肥城市| 星座| 彭州市| 肥西县| 惠来县| 手游| 湘西| 虎林市| 安福县| 武宁县| 宜都市| 上饶县| 乌审旗| 社会| 区。| 南陵县| 斗六市| 寿宁县| 木兰县| 景宁| 定南县| 肇庆市| 吉林市| 冷水江市| 泰顺县| 普陀区| 梨树县| 神木县| 丰都县| 项城市|