PAT 1004. 成绩排名 (20)
来源:互联网 发布:网络直播的利弊 编辑:程序博客网 时间:2024/05/22 06:31
#include<stdio.h>
#include<string.h>
typedef struct
{
char Name[11];
char Num[11];
int score;
}Node;
main()
{
Node stu[20];
int n,Max=0,Min=0,i=0;
scanf("%d",&n);
memset(stu,0,20*sizeof(Node));
for(i=0;i<n;i++)
{
scanf("%s",stu[i].Name);
scanf("%s",stu[i].Num);
scanf("%d",&stu[i].score);
if(stu[i].score>stu[Max].score)Max=i;
if(stu[i].score<stu[Min].score)Min=i;
}
printf("%s %s\n",stu[Max].Name,stu[Max].Num);
printf("%s %s",stu[Min].Name,stu[Min].Num);
}
#include<string.h>
typedef struct
{
char Name[11];
char Num[11];
int score;
}Node;
main()
{
Node stu[20];
int n,Max=0,Min=0,i=0;
scanf("%d",&n);
memset(stu,0,20*sizeof(Node));
for(i=0;i<n;i++)
{
scanf("%s",stu[i].Name);
scanf("%s",stu[i].Num);
scanf("%d",&stu[i].score);
if(stu[i].score>stu[Max].score)Max=i;
if(stu[i].score<stu[Min].score)Min=i;
}
printf("%s %s\n",stu[Max].Name,stu[Max].Num);
printf("%s %s",stu[Min].Name,stu[Min].Num);
}
一开始
这道题出现段错误,经过偶然的顿悟(e..)猛然想到或许是因为他测试的数据不只有20组,所以将20改为100就完美通过了
0 0
- 1004. 成绩排名 (20){PAT}
- PAT 1004. 成绩排名 (20)
- PAT - 1004. 成绩排名 (20)
- [PAT]1004. 成绩排名 (20)
- PAT 1004. 成绩排名 (20)
- PAT 1004. 成绩排名 (20)
- PAT 1004. 成绩排名 (20)
- PAT 1004. 成绩排名 (20)
- PAT:1004. 成绩排名 (20)
- pat 1004. 成绩排名 (20)
- PAT --- 1004. 成绩排名 (20)
- PAT 1004. 成绩排名 (20)
- PAT 1004. 成绩排名 (20)
- PAT 1004. 成绩排名 (20)
- PAT 1004. 成绩排名 (20)
- PAT(B)1004. 成绩排名 (20)
- Java - PAT - 1004. 成绩排名 (20)
- PAT-乙级-1004. 成绩排名 (20)
- CSS 定位(Positioning)
- PAT 1003. 我要通过!(20)
- Zygote,SystemServer启动分析
- [leetcode] 344. Reverse String
- C++二级指针的深入了解
- PAT 1004. 成绩排名 (20)
- 设计模式:组合模式(Composite)
- 别为了学编程而学编程
- ORACLE时间日期星期(SYSDATE)相关处理
- C++重载函数运算符()
- 新人简介
- POJ 1286 polya组合数定理
- 图片裁剪缩略处理小工具类
- 程序员能力提升