文章
145
粉丝
217
获赞
21
访问
82.9k
#include <stdio.h>
typedef struct{
int y,m,d,score;
}XiaoM;
void Sort(XiaoM x[],int n)
{
int i,j;
XiaoM t;
for(i = 0; i < n-1; i++)
for(j = 1; j < n-i; j++)
if(x[j].score > x[j-1].score)
{
t = x[j];
x[j] = x[j-1];
x[j-1] = t;
}
else if(x[j].score == x[j-1].score)
{
if(x[j].y < x[j-1].y)
{
t = x[j];
x[j] = x[j-1];
x[j-1] = t;
}
else if(x[j].y == x[j-1].y)
{
if(x[j].m < x[j-1].m)
{
t = x[j];
x[j] = x[j-1];
x[j-1] = t;
}
else if(x[j].m == x[j-1].m)
{
if(x[j].d < x[j-1].d)
{
t = x[j];
x[j] = x[j-1];
x[j-1] = t;
}
}
}
}
}
int main()
{
int n;
while(scanf("%d",&n) != EOF)
{
XiaoM x[100];
int i;
for(i = 0; i < n; i++)
scanf("%d/%d/%d %d",&x[i].y,&x[i].m,&x[i].d,&x[i].score);
Sort(x,n);
for(i = 0; i < n; i+...
登录后发布评论
暂无评论,来抢沙发