#include<stdio.h>
#include<stdlib.h>
#include<string.h>
struct
{
char name[20];
int m;
} stu [1000];
int main()
{
int n,i,x,y,l=0,p,j,t;
char q[1000];
scanf("%d",&n);
for(i=0; i<n; i++)
{
scanf("%s %d",&stu[i].name,stu[i].m);
}
scanf("%d %d",&x,&y);
for(i=0;i<n-1;i++)
{
for(j=i+1;j<n;j++)
{
if(stu[i].m>stu[j].m)
{
t=stu[i].m;
stu[i].m=stu[j].m;
stu[j].m=t;
strcpy(q,stu[i].name);
strcpy(stu[i].name,stu[j].name);
strcpy(stu[j].name,q);
}
}
}
for(i=0; i<n; i++)
{
if(stu[i].m<x||stu[i].m>y)
l++;
}
if(l==n) printf("No\n");
for(i=0; i<n; i++)
{
if(stu[i].m>=x&&stu[i].m<=y)
printf("%s %d\n",stu[i].name,stu[i].m);
}
return 0;
}
Re: Re: Untitled
From 李清璇, 3 Years ago, written in C, viewed 530 times.
This paste is a reply to Re: Untitled from 李清璇
- go back
URL http://axuhongbo.top/paste/view/08f327aa/diff
Embed
Viewing differences between Re: Untitled and Re: Re: Untitled
— Expand Paste to full width of browser