508 条题解

  • 0
    @ 2017-08-22 10:45:00

    #include "iostream"
    #include "cstdio"
    #include "string"
    using namespace std;
    struct student
    {
    char name[20];
    int year;
    int grade;
    char ban;
    char xi;
    int book;
    int sum1;
    };
    int main()
    {
    struct student stu[101];
    int n,i,j,sum=0,max=0;
    cin>>n;
    for(i=1;i<=n;i++){
    cin>>stu[i].name>>stu[i].year>>stu[i].grade>>stu[i].ban>>stu[i].xi>>stu[i].book;
    stu[i].sum1=0;
    }
    for(i=1;i<=n;i++)
    {
    if(stu[i].year>80&&stu[i].book)
    stu[i].sum1=stu[i].sum1+8000;
    if(stu[i].year>85&&stu[i].grade>80)
    stu[i].sum1=stu[i].sum1+4000;
    if(stu[i].year>90)
    stu[i].sum1=stu[i].sum1+2000;
    if(stu[i].year>85&&stu[i].xi=='Y')
    stu[i].sum1=stu[i].sum1+1000;
    if(stu[i].grade>80&&stu[i].ban=='Y')
    stu[i].sum1=stu[i].sum1+850;
    if(max<stu[i].sum1){
    max=stu[i].sum1;
    j=i;
    }
    sum=sum+stu[i].sum1;
    }
    cout<<stu[j].name<<endl;
    cout<<stu[j].sum1<<endl;
    cout<<sum<<endl;
    return 0;
    }

  • 0
    @ 2017-08-15 00:27:35
    #include <iostream>
    #include <cstdio>
    #include <cstdlib>
    #include <cmath>
    #include <cstring>
    #include <algorithm>
    using namespace std;
    
    int main(){
        int n,b,c,f,i,max=0,maxR=0,money=0,moneymax=0,moneyall=0,maxi=0;
        char d,e,a[120][25];
        scanf("%d",&n);
        for(i=1;i<=n;i++)
        {
            money=0;
            scanf("%s %d %d %c %c %d",a[i],&b,&c,&d,&e,&f);
            if(b>80&&f>=1)
            money=money+8000;
            if(b>85&&c>80)
            money=money+4000;
            if(b>90)
            money=money+2000;
            if(e=='Y'&&b>85)
            money=money+1000;
            if(d=='Y'&&c>80)
            money=money+850;
            moneyall=moneyall+money;
            if(money>moneymax)
            {
                moneymax=money;
                maxi=i;
            }
        }
        puts(a[maxi]);
        printf("%d\n%d",moneymax,moneyall);
        return 0;
    }
    
    
  • 0
    @ 2017-08-12 10:37:20

    #include<string>
    #include<vector>
    #include<iostream>
    using namespace std;

    struct student{
    string name;//姓名
    int average_score;//期末平均成绩
    int class_score;//班级评议成绩
    char is_cadre;//是否是学生干部
    char is_west;//是否是西部学生
    int number_paper;//论文数量
    static int sum;//所有学生的奖学金和
    int money_sum;//某一学生的奖学金和
    student():money_sum(0){}

    void input(){
    cin>>name>>average_score>>class_score>>is_cadre>>is_west>>number_paper;
    }

    void output(){
    cout<<name<<endl;
    cout<<money_sum<<endl;
    cout<<sum<<endl;
    }

    void run(){

    if(average_score > 80 && number_paper >= 1)
    money_sum += 8000;

    if(average_score > 85 && class_score > 80)
    money_sum += 4000;

    if(average_score > 90)
    money_sum += 2000;

    if(average_score > 85 && is_west == 'Y')
    money_sum += 1000;

    if(class_score > 80 && is_cadre == 'Y')
    money_sum += 850;

    sum += money_sum;
    }

    };

    int student::sum = 0;

    int main(){
    int N;
    cin>>N;
    vector<student> s(N, student());
    for(int i = 0; i < N; ++i){
    s[i].input();
    s[i].run();
    }
    int max = 0;
    for(int i = 1; i < N; ++i){
    if(s[max].money_sum < s[i].money_sum){
    max = i;
    }
    }
    s[max].output();

    return 0;
    }

  • 0
    @ 2017-07-30 22:08:31

    #include<cstdio>
    #include<iostream>
    #include<algorithm>
    #include<string>
    using namespace std;
    int n,qian;
    struct italy{
    string name;
    int sco1,sco2,wen;
    char gan,west;
    int money;
    int num;
    }stu[100+5];
    bool cmp(const italy &x,const italy &y)
    {
    if(x.money==y.money) return x.num<y.num;
    else return x.money>y.money;
    }
    int main()
    {
    scanf("%d",&n);
    for(int i=1;i<=n;i++)
    {
    cin>>stu[i].name>>stu[i].sco1>>stu[i].sco2>>stu[i].gan>>stu[i].west>>stu[i].wen;
    stu[i].num=i;
    if(stu[i].sco1>80&&stu[i].wen>=1) stu[i].money+=8000;
    if(stu[i].sco1>85&&stu[i].sco2>80) stu[i].money+=4000;
    if(stu[i].sco1>90) stu[i].money+=2000;
    if(stu[i].sco1>85&&stu[i].west=='Y') stu[i].money+=1000;
    if(stu[i].sco2>80&&stu[i].gan=='Y') stu[i].money+=850;
    qian+=stu[i].money;
    }
    sort(stu+1,stu+n+1,cmp);
    cout<<stu[1].name<<endl<<stu[1].money<<endl<<qian;
    return 0;
    }

  • 0
    @ 2017-07-25 18:43:18

    #include<iostream>
    #include<cstring>
    #include<algorithm>
    using namespace std;
    int main(){
    int n,i;
    cin>>n;
    string a,b;
    int pj,py,lw,jxj_a=0,jxj_b=0,jxj_tt=0;
    char gb,xb;
    for(i=0;i<n;i++)
    {
    cin>> b >> pj >> py >> gb >> xb >> lw;
    if(pj>80 && lw>=1)
    jxj_b+=8000;
    if(pj>85 && py>80)
    jxj_b+=4000;
    if(pj>90)
    jxj_b+=2000;
    if(pj>85 && xb=='Y')
    jxj_b+=1000;
    if(py>80 && gb=='Y')
    jxj_b+=850;
    if(jxj_b>jxj_a){
    jxj_a=jxj_b;
    a=b;
    }
    jxj_tt+=jxj_b;
    jxj_b=0;
    }
    cout<<a<<endl<<jxj_a<<endl<<jxj_tt<<endl;
    return 0;
    }

  • 0
    @ 2017-07-18 20:50:28

    //此题只需使用结构体存储加上不停地循环条件判断即可解决,毫无难度
    //ヽ( ̄▽ ̄)( ̄▽ ̄)~
    #include <stdio.h>
    #include <iostream>
    #include <algorithm>
    #include <cstring>
    using namespace std;
    struct{
    char mz[20];
    int pj;
    int yl;
    char xb;
    char gb;
    int lw;
    }a[105];
    int main(){
    int n,ans[105],sum=0,max=0;
    memset(ans,0,sizeof(ans));
    scanf ("%d",&n);
    for (int i=0;i<n;i++){
    scanf ("%s %d %d %c %c %d",a[i].mz,&a[i].pj,&a[i].yl,&a[i].gb,&a[i].xb,&a[i].lw);
    }
    for (int i=0;i<n;i++){
    if (a[i].pj>80&&a[i].lw>=1) ans[i]+=8000;
    if (a[i].pj>85&&a[i].yl>80) ans[i]+=4000;
    if (a[i].pj>90) ans[i]+=2000;
    if (a[i].pj>85&&a[i].xb=='Y') ans[i]+=1000;
    if (a[i].yl>80&&a[i].gb=='Y') ans[i]+=850;
    }
    max=ans[0];sum+=ans[0];
    int t;
    for (int i=1;i<n;i++){
    if(ans[i]>max) {
    max=ans[i];
    t=i;}
    sum+=ans[i];
    }
    puts (a[t].mz);
    printf ("%d\n%d",max,sum);
    return 0;

  • 0
    @ 2017-07-18 20:26:29
    #include <cstdio>
    #include <iostream>
    #include <cstdlib>
    #include <cstring>
    #include <cmath>
    #include <algorithm>
    #include <bits/stdc++.h>
    
    using namespace std;
    
    int n;
    int ans;
    long long anss;
    
    struct Node
    {
        string name;//姓名
        int lp;//期末成绩
        int cp;//班评成绩
        char cm;//学生干部
        char w;//西部学生
        int at;//论文
        int tot;//总奖学金
    } a[105];
    
    void init()
    {
        scanf ("%d\n",&n);
        for (int i=0; i<n; i++)
        {
            cin>>a[i].name;
            scanf ("%d %d %c %c %d\n",&a[i].lp,&a[i].cp,&a[i].cm,&a[i].w,&a[i].at);
        }
    /*  
        for (int i=0; i<n; i++)
        {
            cout<<a[i].name;
            printf (" %d %d %c %c %d\n",a[i].lp,a[i].cp,a[i].cm,&a[i].w,&a[i].at);
        }
    */
    }
    
    void work()
    {
        int a1;
        for (int i=0; i<n; i++)
        {
            if (a[i].lp>80&&a[i].at>=1)
                a[i].tot+=8000;
            if (a[i].lp>85&&a[i].cp>80)
                a[i].tot+=4000;
            if (a[i].lp>90)
                a[i].tot+=2000;
            if (a[i].lp>85&&a[i].w=='Y')
                a[i].tot+=1000;
            if (a[i].cp>80&&a[i].cm=='Y')
                a[i].tot+=850;
            if (ans<a[i].tot)
            {
                ans=a[i].tot;
                a1=i;
            }
            anss+=a[i].tot;
        }
        cout<<a[a1].name<<endl;
        printf ("%d\n",ans);
        printf ("%lld",anss);
        return;
    }
    
    int main()
    {
        init();
        work();
      while (1);//反抄袭
        return 0;
    }
    
    
  • 0
    @ 2017-07-06 12:18:40

    pascal不哭抱紧我

    type
       Tnode=record
               nam:string;
               adv,cla,num,tot:longint;
               job,west:boolean;
             end;
     var
      st:string;
      N,i,p,q,ans,max:longint;
      a:array[1..100]of Tnode;
      begin
       readln(N);
        max:=0;
        for i:=1 to N do
          begin
            readln(st);
            a[i].job:=false;
            a[i].west:=false;
            p:=pos(' ',st);
            a[i].nam:=copy(st,1,p-1);
            delete(st,1,p);
            p:=pos(' ',st);
            val(copy(st,1,p-1),a[i].adv);
            delete(st,1,p);
            p:=pos(' ',st);
            val(copy(st,1,p-1),a[i].cla);
            delete(st,1,p);
            if st[1]='Y' then a[i].job:=true;
            if st[3]='Y' then a[i].west:=true;
            delete(st,1,4);
            val(st,a[i].num);
            if (a[i].adv>80)and(a[i].num>=1) then inc(a[i].tot,8000);
            if (a[i].adv>85)and(a[i].cla>80) then inc(a[i].tot,4000);
            if a[i].adv>90 then inc(a[i].tot,2000);
            if (a[i].adv>85)and(a[i].west) then inc(a[i].tot,1000);
            if (a[i].cla>80)and(a[i].job) then inc(a[i].tot,850);
            ans:=ans+a[i].tot;
            if a[i].tot>max then
             begin
               max:=a[i].tot;
               q:=i;
             end;
          end;
          writeln(a[q].nam);
          writeln(a[q].tot);
          write(ans);
       end.
    
    
    • @ 2018-01-31 20:22:03

      pascal还有个字符串处理😂

  • 0
    @ 2017-06-29 11:22:08

    #include<iostream>
    #include<string.h>

    using namespace std;
    char d,e;
    string a,g;
    int main()
    {
    int i,b,c,f,n,m=0,k=0,s=0;
    cin>>n;
    for(i=1;i<=n;i++){
    cin>>a>>b>>c>>d>>e>>f;
    m=0;
    if(b>80&&f>=1) m+=8000;
    if(b>85&&c>80) m+=4000;
    if(b>90) m+=2000;
    if(b>85&&e=='Y') m+=1000;
    if(c>80&&d=='Y') m+=850;
    s+=m;
    if(k<m){
    k=m;
    g=a;
    }
    }
    cout<<g<<endl<<k<<endl<<s<<endl;
    return 0;
    }

  • 0
    @ 2017-06-19 22:44:26
    #include <stdio.h>
    #include <malloc.h>
    typedef struct Student
    {
        char name[20];  /* 姓  名 */
        int score;      /*期末成绩*/
        int sscore;     /*评定成绩*/
        char ChairMan;  /*是否干部*/
        char IsWest;    /*是否西部*/
        int Article;    /*论文总数*/
        long Price;     /*奖金总数*/
    }Student;
    void GetResult(Student *std, int count)
    {
        int MaxIndex = 0;
        for (int i = 1; i < count; ++i)
        {
            if (std[i].Price > std[MaxIndex].Price)
            {
                MaxIndex = i;
            }
        }
        printf("%s\n", std[MaxIndex].name);
        printf("%ld\n", std[MaxIndex].Price);
        long long sum = 0;
        for (int i = 0; i < count; ++i)
        {
            sum+=std[i].Price;
        }
        printf("%lld\n", sum);
    }
    void GetPrice(Student *std)                         /*发奖啦*/
    {
        if (std->score > 80 && std-> Article >= 1)      /*期末平均成绩高于80分(>80),并且在本学期内发表1篇或1篇以上论文*/
        {
            std->Price += 8000;
        }
        if (std->score > 85 && std-> sscore > 80)       /*期末平均成绩高于85分(>85),并且班级评议成绩高于80分(>80)*/
        {
            std->Price += 4000;
        }
        if (std->score > 90)                            /*期末平均成绩高于90分(>90)*/
        {
            std->Price += 2000;
        }
        if (std->score > 85 && std-> IsWest == 'Y')     /*期末平均成绩高于85分(>85)的西部省份学生*/
        {
            std->Price += 1000;
        }
        if (std->sscore > 80 && std-> ChairMan == 'Y')  /*级评议成绩高于80分(>80)的学生干部*/
        {
            std->Price += 850;
        }
    }
    int main(int argc, char const *argv[])
    {
        int n;
        scanf("%d", &n);
        Student *std = (Student*)malloc(sizeof(Student)*n); /*动态定义结构体数组*/
        for (int i = 0; i < n; ++i)
        {
            std[i].Price = 0;
            scanf("%s", std[i].name);
            scanf("%d", &std[i].score);
            scanf("%d", &std[i].sscore);
            getchar();
            scanf("%c", &std[i].ChairMan);
            getchar();
            scanf("%c", &std[i].IsWest);
            scanf("%d", &std[i].Article);
        }
        for (int i = 0; i < n; ++i)
        {
            GetPrice(std + i);
        }
        GetResult(std, n);
        return 0;
    }
    
  • 0
    @ 2017-06-19 22:42:53

    #include <stdio.h>
    #include <malloc.h>
    typedef struct Student
    {
    char name[20]; /* 姓 名 /
    int score; /
    期末成绩*/
    int sscore; /*评定成绩*/
    char ChairMan; /*是否干部*/
    char IsWest; /*是否西部*/
    int Article; /*论文总数*/
    long Price; /*奖金总数*/
    }Student;
    void GetResult(Student *std, int count)
    {
    int MaxIndex = 0;
    for (int i = 1; i < count; ++i)
    {
    if (std[i].Price > std[MaxIndex].Price)
    {
    MaxIndex = i;
    }
    }
    printf("%s\n", std[MaxIndex].name);
    printf("%ld\n", std[MaxIndex].Price);
    long long sum = 0;
    for (int i = 0; i < count; ++i)
    {
    sum+=std[i].Price;
    }
    printf("%lld\n", sum);
    }
    void GetPrice(Student std) /发奖啦*/
    {
    if (std->score > 80 && std-> Article >= 1) /*期末平均成绩高于80分(>80),并且在本学期内发表1篇或1篇以上论文*/
    {
    std->Price += 8000;
    }
    if (std->score > 85 && std-> sscore > 80) /*期末平均成绩高于85分(>85),并且班级评议成绩高于80分(>80)*/
    {
    std->Price += 4000;
    }
    if (std->score > 90) /*期末平均成绩高于90分(>90)*/
    {
    std->Price += 2000;
    }
    if (std->score > 85 && std-> IsWest == 'Y') /*期末平均成绩高于85分(>85)的西部省份学生*/
    {
    std->Price += 1000;
    }
    if (std->sscore > 80 && std-> ChairMan == 'Y') /*级评议成绩高于80分(>80)的学生干部*/
    {
    std->Price += 850;
    }
    }
    int main(int argc, char const *argv[])
    {
    int n;
    scanf("%d", &n);
    Student std = (Student)malloc(sizeof(Student)*n); /*动态定义结构体数组*/
    for (int i = 0; i < n; ++i)
    {
    std[i].Price = 0;
    scanf("%s", std[i].name);
    scanf("%d", &std[i].score);
    scanf("%d", &std[i].sscore);
    getchar();
    scanf("%c", &std[i].ChairMan);
    getchar();
    scanf("%c", &std[i].IsWest);
    scanf("%d", &std[i].Article);
    }
    for (int i = 0; i < n; ++i)
    {
    GetPrice(std + i);
    }
    GetResult(std, n);
    return 0;
    }

  • 0
    @ 2017-06-06 08:59:15

    #include<stdio.h>
    #include<stdlib.h>
    struct student{
    char name[100];
    int ag;
    int er;
    char iscadre;
    char iswest;
    int pq;
    int bonus;
    };
    int main(void)
    {
    int a,b,c=0,d,e,f,n;
    scanf("%d",&n);
    struct student *p;
    p=(struct student *)malloc(sizeof(struct student)*n);
    for(a=0;a<n;a++)
    scanf("%s %d %d %c %c %d",p[a].name,&p[a].ag,&p[a].er,&p[a].iscadre,&p[a].iswest,&p[a].pq);
    for(a=0;a<n;a++)
    {
    b=0;
    if(p[a].ag>80&&p[a].pq>0)
    b+=8000;
    if(p[a].ag>85&&p[a].er>80)
    b+=4000;
    if(p[a].ag>90)
    b+=2000;
    if(p[a].ag>85&&p[a].iswest=='Y')
    b+=1000;
    if(p[a].er>80&&p[a].iscadre=='Y')
    b+=850;
    p[a].bonus=b;

    }
    d=p[0].bonus;
    f=d;
    e=0;
    for(a=1;a<n;a++)
    {
    f+=p[a].bonus;
    if(d<p[a].bonus)
    {
    d=p[a].bonus;
    e=a;
    }
    }
    puts(p[e].name);
    printf("%d\n%d\n",p[e].bonus,f);
    return 0;
    }

  • 0
    @ 2017-05-29 23:33:42
    #include<iostream>
    #include<cstdio>
    #include<algorithm>
    #include<cstring>
    using namespace std;
    
    int n;
    
    struct peo
    {
        string name;
        int prize;
    };
    
    peo s[114];
    int all=0;
    
    int main()
    {
        s[0].prize=0;
        cin>>n;
        for(int i=1;i<=n;i++)
        {
            cin>>s[i].name;
            s[i].prize=0;
            int sce,scc,paper;
            string gb,west;
            cin>>sce>>scc>>gb>>west>>paper;
            if(sce>80 && paper>=1) s[i].prize+=8000;
            if(sce>85 && scc>80) s[i].prize+=4000;
            if(sce>90) s[i].prize+=2000;
            if(sce>85 && west=="Y") s[i].prize+=1000;
            if(scc>80 && gb=="Y") s[i].prize+=850;
        }
        int bgest=0;
        for(int i=1;i<=n;i++)
        {
            all+=s[i].prize;
            if(s[i].prize>s[bgest].prize)
            {
                bgest=i;
            }
        }
        cout<<s[bgest].name<<endl<<s[bgest].prize<<endl<<all<<endl;
    }
    
    

    写的有点烦,但是好理解;

  • 0
    @ 2017-05-25 07:20:16

    这道题更像是考基础

    #include<iostream>
    #include<string>
    
    struct Student{
        std::string name;
        int finalResult;
        int classResult;
        char cadre;
        char studentOfWest;
        int papers;
    };
    
    Student initStudent();
    int compute(Student student);
    void computeAllStudents();
    
    
    int main()
    {
        computeAllStudents();
    
        return 0;
    }
    
    Student initStudent()
    {
        using namespace std;
    
        string name;
        int finalResult;
        int classResult;
        char cadre;
        char studentOfWest;
        int papers;
        cin >> name >> finalResult >> classResult >> cadre >> studentOfWest >> papers;
        Student temp={
            name,
            finalResult,
            classResult,
            cadre,
            studentOfWest,
            papers
        };
    
        return temp;
    }
    
    void computeAllStudents()
    {
        using namespace std;
        int quantity;
        
        cin >> quantity;
        Student *students = new Student[quantity];
        for(int i=0;i<quantity;i++)
        {
            students[i] = initStudent();
        }
    
    // compute
        Student best = {"", 0, 0, 'N', 'N', 0};
        int AllMoney = 0;
        for(int i=0;i<quantity;i++)
        {
            if(compute(students[i]) > compute(best))
            {
                best = students[i];
            }
    
            AllMoney += compute(students[i]);
        }
    // print
        cout << best.name << endl;
        cout << compute(best) << endl;
        cout << AllMoney <<endl;    
    
    }
    
    int compute(Student student)
    {
        using namespace std;
        int money=0;
    
        if(student.papers != 0 && student.finalResult > 80)
        {
            money += 8000;
        }
    
        if(student.finalResult > 85 && student.classResult > 80)
        {
            money += 4000;
        }
    
        if(student.finalResult > 90)
        {
            money += 2000;
        }
    
        if(student.studentOfWest == 'Y' && student.finalResult > 85)
        {
            money += 1000;
        }
    
        if(student.classResult > 80 && student.cadre == 'Y')
        {
            money += 850;
        }
    
        return money;
    }
    
    
  • 0
    @ 2017-05-15 17:01:08

    #include<iostream>
    #include<string>
    using namespace std;

    int num = 0;
    int tot = 0;
    string highname;
    int highmon = 0;
    struct student
    {
    string name;
    int aver;
    int disc;
    char is_vip;
    char is_west;
    int artical;
    int money = 0;
    };

    int main()
    {
    student stu[100];
    cin>>num;
    for(int i = 0; i<num; i++)
    cin>>stu[i].name>>stu[i].aver>>stu[i].disc>>stu[i].is_vip>>stu[i].is_west>>stu[i].artical;
    for(int i = 0; i<num; i++)
    {
    if(stu[i].aver>80 && stu[i].artical>0)
    stu[i].money += 8000;
    if(stu[i].aver>85 && stu[i].disc>80)
    stu[i].money += 4000;
    if(stu[i].aver>90)
    stu[i].money += 2000;
    if(stu[i].aver>85 && stu[i].is_west == 'Y')
    stu[i].money += 1000;
    if(stu[i].disc>80 && stu[i].is_vip == 'Y')
    stu[i].money += 850;
    if(stu[i].money>highmon)
    {
    highmon = stu[i].money;
    highname = stu[i].name;
    }
    tot += stu[i].money;
    }
    cout<<highname<<endl<<highmon<<endl<<tot<<endl;
    }

  • 0
    @ 2017-05-15 13:33:40

    #include<iostream>
    int MAXN=1000;
    using namespace std;
    int main()
    {
    int a[MAXN][MAXN];
    int b[MAXN];
    memset(b,0,sizeof(b));
    int n,i,j,s,temp;
    int k=0;
    cin>>i;
    for(n=1;n<=i;n++)
    {
    for(j=1;j<=6;j++)
    {
    if(j==1||j==4||j==5){
    (char) a[n][j];
    }
    cin>>a[n][j];
    if(a[n][2]>80&&a[n][6]>=1){
    b[n]+=8000;
    }
    if(a[n][2]>85&&a[n][3]>80){
    b[n]+=4000;
    }
    if(a[n][2]>90){
    b[n]+=2000;
    }
    if(a[n][2]>85&&a[n][5]==Y){
    b[n]+=1000;
    }
    if(a[n][3]>80&&a[n][4]==Y){
    b[n]+=850;
    }
    s=b[1];
    temp=1;
    if (b[n]>s){
    s=b[n];
    temp=n;
    }
    k+=b[n];
    }
    }
    cout<<a[temp][1]<<endl;
    cout<<b[temp]<<endl;
    cout<<k<<endl;
    return 0;
    }

  • 0
    @ 2017-05-15 13:33:27

    #include<iostream>
    int MAXN=1000;
    using namespace std;
    int main()
    {
    int a[MAXN][MAXN];
    int b[MAXN];
    memset(b,0,sizeof(b));
    int n,i,j,s,temp;
    int k=0;
    cin>>i;
    for(n=1;n<=i;n++)
    {
    for(j=1;j<=6;j++)
    {
    if(j==1||j==4||j==5){
    (char) a[n][j];
    }
    cin>>a[n][j];
    if(a[n][2]>80&&a[n][6]>=1){
    b[n]+=8000;
    }
    if(a[n][2]>85&&a[n][3]>80){
    b[n]+=4000;
    }
    if(a[n][2]>90){
    b[n]+=2000;
    }
    if(a[n][2]>85&&a[n][5]==Y){
    b[n]+=1000;
    }
    if(a[n][3]>80&&a[n][4]==Y){
    b[n]+=850;
    }
    s=b[1];
    temp=1;
    if (b[n]>s){
    s=b[n];
    temp=n;
    }
    k+=b[n];
    }
    }
    cout<<a[temp][1]<<endl;
    cout<<b[temp]<<endl;
    cout<<k<<endl;
    return 0;
    }

  • 0
    @ 2017-05-08 13:32:15

    //不要在意我的命名

    #include <stdio.h>
    typedef struct
    {
        char name[20], exam, rank, isMonitor, isWesterner, text;
    }fuck;
    int getMoney( fuck data )
    {
        int money = 0;
        if ( data.exam > 80 && data.text >= 1 )
            money += 8000;
        if ( data.exam > 85 && data.rank > 80 )
            money += 4000;
        if ( data.exam > 90 )
            money += 2000;
        if ( data.exam > 85 && data.isWesterner == 'Y' )
            money += 1000;
        if ( data.rank > 80 && data.isMonitor == 'Y' )
            money += 850;
        return(money);
    }
    
    
    int main()
    {
        int data, total = 0;
        scanf( "%d", &data );
        fuck    datas[data];
        int max = 0;
        fuck    max_man;
        for ( int n = 0; n < data; n++ )
        {
            scanf( "%s %d %d %c %c %d", &datas[n].name, &datas[n].exam, &datas[n].rank, &datas[n].isMonitor, &datas[n].isWesterner, &datas[n].text );
            int m = getMoney( datas[n] );
            if ( m > max )
            {
                max_man = datas[n];
                max = m;
            }
            total += m;
        }
        printf( "%s\n%d\n%d", max_man.name, max, total );
    }
    
    
    
    
  • 0
    @ 2017-05-07 12:33:15

    直接模拟就好了对吧~

    #include <iostream>
    #include <cstdio>
    #include <algorithm>
    #include <cstring>
    #include <cmath>
    #include <iomanip>
    #include <cstdlib>
    using namespace std;
    
    struct people
    {
        string name;
        int qimo,banji;
        char ganbu,xibu;
        int lunwen;
        int ans;
    }a[102];
    int n;
    
    int main()
    {
        cin>>n;
        for(int i=1;i<=n;i++)
            cin>>a[i].name>>a[i].qimo>>a[i].banji>>a[i].ganbu>>a[i].xibu>>a[i].lunwen,a[i].ans=0;
        for(int i=1;i<=n;i++)
        {
            if(a[i].banji>80&&a[i].ganbu=='Y')
                a[i].ans+=850;
            if(a[i].qimo>80&&a[i].lunwen>=1)
                a[i].ans+=8000;
            if(a[i].qimo>85&&a[i].banji>80)
                a[i].ans+=4000;
            if(a[i].qimo>90)
                a[i].ans+=2000;
            if(a[i].qimo>85&&a[i].xibu=='Y')
                a[i].ans+=1000;
        }
        int Max=-1;
        string k;
        int tot=0;
        for(int i=n;i>=1;i--)
        {
            tot+=a[i].ans;
            if(a[i].ans>=Max)
            {
                k=a[i].name;
                Max=a[i].ans;
            }   
        }
        cout<<k<<endl;
        cout<<Max<<endl;
        cout<<tot<<endl;
        return 0;
    }
    
  • 0
    @ 2017-05-06 17:43:52

    #include <iostream>
    #include <cstdio>
    #include <string.h>
    #include <cmath>
    using namespace std;
    const int maxn = 105;
    char name[maxn][20];
    int re[maxn];
    int main(){
    int n;
    int a,b,c;
    char d,e;
    scanf("%d",&n);
    memset(re,0,sizeof(re));
    int maxm = 0;
    int m = -1;
    int sum = 0;
    for(int i=0;i<n;i++){
    scanf("%s",name[i]);
    scanf("%d%d%c%c%c%c%d",&a,&b,&d,&d,&e,&e,&c);
    // cout<<name[i]<<endl;
    // cout<<a<<b<<d<<e<<c<<endl;
    if(a>90){
    re[i] += 2000;
    }
    if(a>80&&c>=1)
    re[i] += 8000;
    if(a>85&&b>80)
    re[i] += 4000;
    if(a>85&&e=='Y')
    re[i] += 1000;
    if(b>80&&d=='Y')
    re[i] += 850;
    if(re[i]>maxm){
    maxm = re[i];
    m = i;
    }
    sum += re[i];
    }
    cout<<name[m]<<endl;
    cout<<re[m]<<endl;
    cout<<sum<<endl;
    return 0;
    }

信息

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