萌新求解,并不知道哪里有错

// input code here

#include<stdio.h>
//院士奖学金
int yuanshi(int a,int b){
int money=0;
if(a>80&&b>=1)
money=8000;
return money;
}
//五四奖学金
int wusi(int a,int b){
int money=0;
if(a>85&&b>80)
money=4000;
return money;
}
//成绩优秀奖
int chengji(int a){
int money=0;
if(a>90)
money=2000;
return money;
}
//西部奖学金
int xibu(int a,char b){
int money=0;
if(a>85&&b=='Y')
money=1000;
return money;
}
//班级贡献奖
int banji(int a,char b){
int money=0;
if(a>80&&b=='Y')
money=850;
return money;
}
#define N 100
//主函数
int main(){
int n,score1[N],score2[N],m[N],gold[N]={0},i,j,max,g=0;
//n学生总数,score1期末成绩,score2班级成绩,m发表论文数量,
//gold奖金数,i计数器,max最佳编号,g奖金总数
char mate[N],west[N];
char name[N][20];
//name姓名,mate是否为干部,west是否为西部学生
scanf("%d",&n);
//获取
for(i=0;i<n;i++){
scanf(" %s %d %d %c %c %d",
name[i],&score1[i],&score2[i],&mate[i],&west[i],&m[i]);
gold[i]= yuanshi(score1[i],m[i]) + wusi(score1[i],score2[i]) +
chengji(score1[i]) + xibu(score1[i],west[i]) + banji(score2[i],mate[i]) ;
g=g+gold[i];
}
//寻找最贵奖学金
max=0;
for(i=0;i<n;i++){
if(n==1)
break;
else{
j=i+1;
if(gold[max]<gold[j])
max=i;
}
}
//输出
puts(name[max]);
printf("%d\n%d",gold[max],g);
return 0;
}

0 条评论

目前还没有评论...

信息

ID
1001
难度
5
分类
模拟 点击显示
标签
递交数
39089
已通过
12717
通过率
33%
被复制
121
上传者