。。。30分,有大神来看看吗。。。

// #include<stdio.h>
struct student{
    char name[20];
    int score;
    int scoreclass;
    char job;
    char west;  
    int num;
    int money;
}stu[101];
int main(){
  int N,i,max,t=0,sum=0;
  scanf("%d",&N);
for(i=0;i!=N;i++)
{scanf("%s %d %d %c %c %d",stu[i].name ,&stu[i].score ,&stu[i].scoreclass ,&stu[i].job ,&stu[i].west ,&stu[i].num ); 
  stu[i].money =0;
 if(stu[i].score >80&&stu[i].num >=1) stu[i].money +=8000;
 if(stu[i].score >85&&stu[i].scoreclass >80) stu[i].money +=4000;
 if(stu[i].score >90) stu[i].money +=2000;
 if(stu[i].score >85&&stu[i].west =='Y') stu[i].money +=1000;
 if(stu[i].score >80&&stu[i].job =='Y') stu[i].money +=850;
 sum+=stu[i].money ;    
 }
max=0;
for(i=0;i!=N;i++)   {
    if(max<stu[i].money ){max=stu[i].money ;t=i;}}
printf("%s\n%d\n",stu[t].name ,stu[t].money );
printf("%d",sum);}

2 条评论

  • @ 2017-02-16 16:58:15
    #include<stdio.h>
    #include<stdlib.h>
    #include<cstring>
    #include<string>
    #include<algorithm>
    #include<iostream>
    using namespace std;
    struct red
    {
        char name[25];
        int qm;
        int py;
        char x[2];
        char w[2];
        int lw;
        int jxj;
    }str[110];
    int n,sum,ans=1;
    int main()
    {
        scanf("%d",&n);
        for(int i=1;i<=n;i++)
            scanf("%s%d%d%s%s%d",str[i].name,&str[i].qm,&str[i].py,str[i].x,str[i].w,&str[i].lw);
        for(int i=1;i<=n;i++)
        {
            if(str[i].qm>80&&str[i].lw>0) str[i].jxj+=8000;
            if(str[i].qm>85&&str[i].py>80) str[i].jxj+=4000;
            if(str[i].qm>90) str[i].jxj+=2000;
            if(str[i].qm>85&&str[i].w[0]=='Y') str[i].jxj+=1000;
            if(str[i].py>80&&str[i].x[0]=='Y') str[i].jxj+=850;
            sum+=str[i].jxj;
            if(str[i].jxj>str[ans].jxj) ans=i;
        }
        printf("%s\n%d\n%d",str[ans].name,str[ans].jxj,sum);
        return 0;
    }
    
  • @ 2017-02-16 16:58:13
    #include<stdio.h>
    #include<stdlib.h>
    #include<cstring>
    #include<string>
    #include<algorithm>
    #include<iostream>
    using namespace std;
    struct red
    {
        char name[25];
        int qm;
        int py;
        char x[2];
        char w[2];
        int lw;
        int jxj;
    }str[110];
    int n,sum,ans=1;
    int main()
    {
        scanf("%d",&n);
        for(int i=1;i<=n;i++)
            scanf("%s%d%d%s%s%d",str[i].name,&str[i].qm,&str[i].py,str[i].x,str[i].w,&str[i].lw);
        for(int i=1;i<=n;i++)
        {
            if(str[i].qm>80&&str[i].lw>0) str[i].jxj+=8000;
            if(str[i].qm>85&&str[i].py>80) str[i].jxj+=4000;
            if(str[i].qm>90) str[i].jxj+=2000;
            if(str[i].qm>85&&str[i].w[0]=='Y') str[i].jxj+=1000;
            if(str[i].py>80&&str[i].x[0]=='Y') str[i].jxj+=850;
            sum+=str[i].jxj;
            if(str[i].jxj>str[ans].jxj) ans=i;
        }
        printf("%s\n%d\n%d",str[ans].name,str[ans].jxj,sum);
        return 0;
    }
    
  • 1

信息

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