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

首頁(yè) > 學(xué)院 > 開發(fā)設(shè)計(jì) > 正文

1014_排名

2019-11-10 20:14:25
字體:
來(lái)源:轉(zhuǎn)載
供稿:網(wǎng)友
// 1014_排名.cpp : 定義控制臺(tái)應(yīng)用程序的入口點(diǎn)。//題目1014:排名//時(shí)間限制:1 秒內(nèi)存限制:32 兆特殊判題:否提交:9152解決:2758//題目描述:// 今天的上機(jī)考試雖然有實(shí)時(shí)的Ranklist,但上面的排名只是根據(jù)完成的題數(shù)排序,沒(méi)有考慮每題的分值,所以并不是最后的排名。給定錄取分?jǐn)?shù)線,請(qǐng)你寫程序找出最后通過(guò)分?jǐn)?shù)線的考生,并將他們的成績(jī)按降序打印。//輸入:// 測(cè)試輸入包含若干場(chǎng)考試的信息。每場(chǎng)考試信息的第1行給出考生人數(shù)N ( 0 < N < 1000 )、考題數(shù)M ( 0 < M < = 10 )、分?jǐn)?shù)線(正整數(shù))G;第2行排序給出第1題至第M題的正整數(shù)分值;以下N行,每行給出一名考生的準(zhǔn)考證號(hào)(長(zhǎng)度不超過(guò)20的字符串)、該生解決的題目總數(shù)m、以及這m道題的題號(hào)(題目號(hào)由1到M)。 // 當(dāng)讀入的考生人數(shù)為0時(shí),輸入結(jié)束,該場(chǎng)考試不予處理。//輸出:// 對(duì)每場(chǎng)考試,首先在第1行輸出不低于分?jǐn)?shù)線的考生人數(shù)n,隨后n行按分?jǐn)?shù)從高到低輸出上線考生的考號(hào)與分?jǐn)?shù),其間用1空格分隔。若有多名考生分?jǐn)?shù)相同,則按他們考號(hào)的升序輸出。//樣例輸入://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//樣例輸出://3//CS003 60//CS001 37//CS004 37//0//1//CS000000000000000002 20//來(lái)源://2005年浙江大學(xué)計(jì)算機(jī)及軟件工程研究生機(jī)試真題#include "stdafx.h"#include "stdio.h"#include "string.h"#include "stdlib.h"#define maxN 1001#define maxM 12#define maxG 100struct student{ char id[22]; int PRoblem[maxM]; //答對(duì)的題目及分值 int score; int npro; //答對(duì)的題目數(shù) int isPass;}student[maxN],student2[maxN];int compare(const void *p,const void *q){ struct student *p1 = (struct student *)p; struct student *q1 = (struct student *)q; if((*p1).score == (*q1).score) return strcmp((*p1).id,(*q1).id); else return (*q1).score - (*p1).score;}int main(){ int N,M,G; while(scanf("%d",&N)!=EOF) { if(!N) break; else { int n=0; scanf("%d %d",&M,&G); int prob[maxM]; for(int i=1;i<=M;i++) scanf("%d",&prob[i]); for(int i=1;i<=N;i++) { student[i].score = 0; student[i].isPass = 0; scanf("%s %d",student[i].id,&student[i].npro); int temp; for(int j=1;j<=student[i].npro;j++) { scanf("%d",&temp); student[i].score += prob[temp]; } if (student[i].score>=G) { student2[n] = student[i]; n++; student[i].isPass = 1; } } qsort(student2,n,sizeof(student2[0]),compare); printf("%d/n",n); for(int k = 0;k<n;k++) printf("%s %d/n",student2[k].id,student2[k].score); } } return 0;}
發(fā)表評(píng)論 共有條評(píng)論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 石泉县| 墨脱县| 晋宁县| 楚雄市| 鹤庆县| 博白县| 原阳县| 迁安市| 滕州市| 金寨县| 南溪县| 曲阳县| 昆山市| 云霄县| 鲁山县| 胶州市| 阳江市| 大埔县| 稻城县| 祁东县| 五河县| 崇礼县| 玉林市| 长子县| 台中县| 仁化县| 滦平县| 武陟县| 荔浦县| 山丹县| 通渭县| 紫阳县| 尚义县| 鹿泉市| 铅山县| 东山县| 嵩明县| 白河县| 澳门| 屏边| 定襄县|