hdu 1.3.2 排名
来源:互联网 发布:图像处理区域填充算法 编辑:程序博客网 时间:2024/05/29 14:27
/*排名*/
#include <cstdio>#include<cstring>
using namespace std;
struct infor
{
char name[25];//编号
int n;//做出题的个数
int bianhao[15];//做出题的编号
int goal;//得到的分数
};
int main()
{
int N=0,M=0,G=0;
int sorce[15];//记录每道题的分数
struct infor In[1005];
while(scanf("%d",&N)==1&&N!=0)
{
scanf("%d%d",&M,&G);
for(int i=0;i<M;i++)
scanf("%d",&sorce[i]);
int sum,num=0;
for(int j=0;j<N;j++)
{
scanf("%s",In[j].name);
scanf("%d",&In[j].n);
for(int i=0;i<In[j].n;i++)
scanf("%d",&In[j].bianhao[i]);
sum=0;
if(In[j].n>=0)
{
for(int u=0;u<In[j].n;u++)//计算得分
sum=sum+sorce[In[j].bianhao[u]-1];
if(sum>=G)
num++;
In[j].goal=sum;
}
else In[j].goal=0;
}
if(num)
{
struct infor A;
int index;
for(int i=0;i<N;i++)//对分数进行排序
{index=i;
for(int j=i+1;j<N;j++)
if(In[index].goal<In[j].goal)
index=j;
A=In[index];
In[index]=In[i];
In[i]=A;
}
for(int r=0;r<N-1;r++)//把相同分数的按照考号排序for(int q=0;q<N-1;q++)
if(In[q].goal==In[q+1].goal&&strcmp(In[q].name,In[q+1].name)>0)
{
A=In[q];
In[q]=In[q+1];
In[q+1]=A;
}
printf("%d\n",num);
for(int j=0;j<N;j++)//输出结果
if(In[j].goal>=G)
{
printf("%s %d\n",In[j].name,In[j].goal);
In[j].goal=0;
}
}
else
printf("%d\n",0);
}
return 0;
}
0 0
- hdu 1.3.2 排名
- HDU 1.3.3 排名
- HDU 1.3.3 排名
- hdu 排名
- hdu 杭电 1.3.1 1236 排名
- 考试排名 hdu 2903
- hdu 2093 考试排名
- HDU 1236 排名
- HDU 2093 - 考试排名
- HDU-1236 排名
- HDU 2093 考试排名
- HDU 1236 ( 排名 )
- HDU 2093 考试排名
- HDU考试排名
- hdu 2093 考试排名
- hdu 题目1236 排名
- hdu-1236--排名
- hdu 1236 排名
- HDOJ 5124 lines 【线段树 & 离散化】
- Ubuntu14.04 LTS更新源
- windows快捷键
- 测试csdn博客能否在移动端显示
- SystemC分析(1)-基本数据类型的实现
- hdu 1.3.2 排名
- IOS毛玻璃效果
- MFC进度条控件CProgressCtrl实现进度滚动效果
- 数据挖掘的基本过程
- 内存管理高级
- Android 百度地图SDK v_3_4_0学习笔记(一)环境搭建
- Effective C++读书笔记-----条款20:宁以pass-by-reference-to-const替换pass-by-value
- Jackson2笔记
- C语言中#,##和#@