515 条题解

  • 0
    @ 2017-02-06 23:57:03
    #include<iostream>
    #include<cstdio>
    #include<cstdlib>
    #include<cstring>
    #include<algorithm>
    #include<cmath>
    
    using namespace std;
    
    #define rank int
    
    inline int read(){
        int x = 0 , f = 1;char ch = getchar();
        for( ; !isdigit(ch) ; ch = getchar() ) if( ch == '-' ) f = -1;
        for( ; isdigit(ch) ; ch = getchar() ) x = x * 10 + ch - '0';
        return x * f;
    }
    
    int ALL_STUDENT_SCHOLARSHIP;
    
    const int maxn = 110;
    
    bool MakeProChoise(char IsProForInput){
        if(IsProForInput == 'Y'){
            return true;
        }
        
        return false;
    }
    
    struct data{
        string name;
        
        int id;
        
        int AvgEnd , AvgClass , NumPassage;
        
        bool IsWest , IsPro;
        
        int Scholarship;
        
        void input(rank ii){
            id = ii;
            
            cin >> name;
            
            AvgEnd = read() , AvgClass = read();
            
            char IsWestInput , IsProInput;
            
            scanf("%c %c",&IsProInput , &IsWestInput);
            
            IsPro = MakeProChoise(IsProInput) , IsWest = MakeProChoise(IsWestInput);
            
            NumPassage = read();
            
            Scholarship
            =
            ((AvgEnd > 80 && NumPassage >= 1) ? 8000 : 0)
            +
            ((AvgEnd > 85 && AvgClass > 80) ? 4000 : 0)
            +
            ((AvgEnd > 90) ? 2000 : 0)
            +
            ((AvgEnd > 85 && IsWest) ? 1000 : 0)
            +
            ((AvgClass > 80 && IsPro) ? 850 : 0)
            ;
            
            ALL_STUDENT_SCHOLARSHIP += Scholarship;
            
            return ;
        }
        
        bool operator < (const data &k) const {
            return Scholarship < k.Scholarship;
        }
        
    }person[maxn];
    
    int n;
    
    void output(){
        cout << person[n].name << endl;
        
        printf("%d\n",person[n].Scholarship);
        
        printf("%d\n",ALL_STUDENT_SCHOLARSHIP);
        
        return ;
    }
    
    int main(){
        n = read();
        
        for(int i = 1 ; i <= n ; i ++){
            person[i].input(i);
        }
        
        sort(person + 1 , person + n + 1);
    
        output();
    }```
    
  • 0
    @ 2017-01-31 22:54:14
  • 0
    @ 2017-01-14 18:38:24

    这个错在哪了,我找不到啊!
    #include<iostream>
    #include<iomanip>
    #include<string>
    #include<algorithm>
    #include<cmath>
    using namespace std;
    struct student
    {
    string nam;
    int score1;
    int score2;
    char ganbu;
    char west;
    int lunwen;
    int money;
    int a;
    bool operator<(const student&t)const
    {
    if(money!=t.money)return money>t.money;
    else return a<t.a;
    }
    };
    student s[101];
    int n,i,sum;
    int main()
    {
    cin>>n;
    sum=0;
    for(i=0;i<n;i++)
    {
    cin>>s[i].nam>>s[i].score1>>s[i].score2>>s[i].ganbu>>s[i].west>>s[i].lunwen;
    s[i].a=i;
    s[i].money=0;
    if((s[i].score1>80)&&(s[i].lunwen>0)) s[i].money=s[i].money+8000;
    if((s[i].score1>85)&&(s[i].score2>80)) s[i].money=s[i].money+4000;
    if(s[i].score1>90) s[i].money=s[i].money+2000;
    if((s[i].score1>85)&&(s[i].west=='Y')) s[i].money=s[i].money+1000;
    if((s[i].score1>80)&&(s[i].ganbu=='Y')) s[i].money=s[i].money+850;
    sum=sum+s[i].money;
    }
    sort(s,s+n);
    cout<<s[0].nam<<endl<<s[0].money<<endl<<sum<<endl;
    return 0;
    }

    测试数据 #0: Accepted, time = 0 ms, mem = 592 KiB, score = 10
    测试数据 #1: WrongAnswer, time = 15 ms, mem = 588 KiB, score = 0
    测试数据 #2: WrongAnswer, time = 0 ms, mem = 588 KiB, score = 0
    测试数据 #3: WrongAnswer, time = 0 ms, mem = 588 KiB, score = 0
    测试数据 #4: Accepted, time = 0 ms, mem = 588 KiB, score = 10
    测试数据 #5: WrongAnswer, time = 0 ms, mem = 588 KiB, score = 0
    测试数据 #6: WrongAnswer, time = 0 ms, mem = 588 KiB, score = 0
    测试数据 #7: Accepted, time = 0 ms, mem = 584 KiB, score = 10
    测试数据 #8: WrongAnswer, time = 0 ms, mem = 588 KiB, score = 0
    测试数据 #9: WrongAnswer, time = 0 ms, mem = 592 KiB, score = 0
    WrongAnswer, time = 15 ms, mem = 592 KiB, score = 30

  • 0
    @ 2017-01-03 01:36:19

    最后一个条件打错数字。。。。。我不想说话了,附代码
    测试数据 #0: Accepted, time = 0 ms, mem = 512 KiB, score = 10

    测试数据 #1: Accepted, time = 0 ms, mem = 512 KiB, score = 10

    测试数据 #2: Accepted, time = 0 ms, mem = 512 KiB, score = 10

    测试数据 #3: Accepted, time = 0 ms, mem = 512 KiB, score = 10

    测试数据 #4: Accepted, time = 0 ms, mem = 512 KiB, score = 10

    测试数据 #5: Accepted, time = 0 ms, mem = 512 KiB, score = 10

    测试数据 #6: Accepted, time = 0 ms, mem = 512 KiB, score = 10

    测试数据 #7: Accepted, time = 0 ms, mem = 512 KiB, score = 10

    测试数据 #8: Accepted, time = 0 ms, mem = 512 KiB, score = 10

    测试数据 #9: Accepted, time = 0 ms, mem = 512 KiB, score = 10

    Accepted, time = 0 ms, mem = 512 KiB, score = 100
    ```c++
    #include<cstdio>
    #include<algorithm>
    #include<cstdlib>
    #include<cstring>
    int main()
    {
    int n,a,b,e,ch[101];
    char name[21],maxname[21],c[2],d[2];
    memset(ch,0,sizeof(ch));
    scanf("%d",&n);
    int max = 0,sum=0;;
    for(int i=0;i<n;i++){
    scanf("%s%d%d",&name,&a,&b);
    getchar();
    scanf("%s%s%d",&c,&d,&e);
    if(a>80&&e>=1) ch[i] += 8000;
    if(a>85&&b>80) ch[i] += 4000;
    if(a>90) ch[i] += 2000;
    if(a>85&&strcmp(d,"Y") == 0) ch[i] += 1000;
    if(b>80&&strcmp(c,"Y") == 0) ch[i] += 850;
    sum += ch[i];
    if(ch[i] > max) {max = ch[i];strcpy(maxname,name);}
    }
    printf("%s\n%d\n%d",maxname,max,sum);
    return 0 ;
    }

  • 0
    @ 2016-11-17 16:42:22

    AC了!
    向大家分享部分代码

    struct jia
    {
        string n;   //姓名 
        int q,b,l,m;    //期末成绩,班级成绩,论文,奖学金 
        char g,x;   //干部,西部 
    }a[100];
    
    for(i=0;i<n;i++)
        {
            if(a[i].q>80&&a[i].l>0) a[i].m=a[i].m+8000;
            if(a[i].q>85&&a[i].b>80)    a[i].m=a[i].m+4000;
            if(a[i].q>90)   a[i].m=a[i].m+2000;
            if(a[i].q>85&&a[i].x=='Y')  a[i].m=a[i].m+1000;
            if(a[i].b>80&&a[i].g=='Y')  a[i].m=a[i].m+850;
            if(a[i].m>max)  max=a[i].m;
        }
    
    

    希望能帮到你们!

  • 0
    @ 2016-11-16 23:27:02

    #include<cstdio>
    int n,s[101],k,h,sum;
    struct node
    {
    char name[20];
    int end;
    int often;
    char job;
    char west;
    int a;
    }f[101];
    int main()
    {
    scanf("%d",&n);
    for(int i=0;i<n;i++)
    {
    scanf("%s %d %d %c %c %d",f[i].name,&f[i].end,&f[i].often,&f[i].job,&f[i].west,&f[i].a);
    if(f[i].end>80&&f[i].a>=1) s[i]+=8000;
    if(f[i].end>85&&f[i].often>80) s[i]+=4000;
    if(f[i].end>90) s[i]+=2000;
    if(f[i].end>85&&f[i].west=='Y') s[i]+=1000;
    if(f[i].often>80&&f[i].job=='Y') s[i]+=850;
    sum+=s[i];
    if(s[i]>k)
    {
    k=s[i];h=i;
    }
    }
    puts(f[h].name);
    printf("%d\n%d",s[h],sum);
    }

  • 0
    @ 2016-11-08 19:45:34

    var a,b,c,d,e,f,g,h,i,n,j,sum,max:longint;
    k:integer;
    s,s1,ss:string;
    begin
    readln(n);
    for i:=1 to n do
    begin
    h:=0;
    readln(s);
    s1:=copy(s,1,pos(' ',s)-1);
    delete(s,1,pos(' ',s));
    val(copy(s,1,pos(' ',s)-1),a,k);
    delete(s,1,pos(' ',s));
    val(copy(s,1,pos(' ',s)-1),b,k);
    delete(s,1,pos(' ',s));
    if s[1]='Y' then c:=1 else c:=0;
    delete(s,1,2);
    if s[1]='Y' then d:=1 else d:=0;
    delete(s,1,2);
    val(copy(s,1,length(s)),e,k);
    if (a>80) and (e>0) then inc(h,8000);
    if (a>85) and (b>80) then inc(h,4000);
    if (a>90) then inc(h,2000);
    if (a>85) and (d=1) then inc(h,1000);
    if (b>80) and (c=1) then inc(h,850);
    inc(sum,h);
    //writeln(a,' ',b,' ',c,' ',d,' ',e,' ',h);
    if h>max then begin max:=h; ss:=s1; end;
    end;
    writeln(ss);
    writeln(max);
    writeln(sum);
    end.

  • 0
    @ 2016-11-05 19:07:46

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

    long moneyAll = 0;
    int maxMoney = 0;
    int bestNumber;
    int studentNum = 0;

    class Cstudent
    {
    private:
    int number;
    string name;
    int endPride;
    int classPride;
    char manager;
    char western;
    int article;
    int money;
    public:
    Cstudent()
    {
    money = 0;
    studentNum++;
    number = studentNum;
    cin >> name >> endPride >> classPride >> manager >> western >> article;
    }

    void award1()
    {
    if(endPride > 80 && article >= 1)
    {
    money += 8000;
    }
    }

    void award2()
    {
    if(endPride > 85 && classPride > 80)
    {
    money += 4000;
    }
    }

    void award3()
    {
    if(endPride > 90)
    {
    money += 2000;
    }
    }

    void award4()
    {
    if(endPride > 85 && western == 'Y')
    {
    money += 1000;
    }
    }

    void award5()
    {
    if(classPride > 80 && manager == 'Y')
    {
    money += 850;
    }
    }

    void best()
    {
    if(money > maxMoney)
    {
    maxMoney = money;
    bestNumber = number - 1;
    }
    }

    void get()
    {
    award1();
    award2();
    award3();
    award4();
    award5();
    best();
    moneyAll += money;
    }

    void getName()
    {
    cout << name << endl << money << endl;
    }
    };

    int main()
    {
    int n;
    cin >> n;
    Cstudent student[n];

    int i;
    for (i=0;i<n;i++)
    {
    student[i].get();
    }
    student[bestNumber].getName();
    cout << moneyAll;
    return 0;
    }

  • 0
    @ 2016-11-05 00:06:29

    #include<stdio.h>
    #include<string.h>
    int n,final,clas,c,s,w;
    char name[100][52];
    int main()
    {
    int all=0,max=0,len=0,t,e,j;
    scanf("%d",&n);
    for(int i=0;i<n;i++)
    {
    int money=0;
    scanf("%s",&name[i]);
    scanf("%d %d %s %s %d",&final,&clas,&s,&w,&c);
    t=s=='Y'?1:0;
    e=w=='Y'?1:0;
    if ((final>80)&&(c>0)) money+=8000;

    if ((final>85)&&(clas>80)) money+=4000;

    if(final>90) money+=2000;
    if(final>85&&e)money+=1000;
    if(clas>80&&t)money+=850;
    all+=money;
    if(money>max){
    max=money;j=i;
    }
    }
    printf("%s\n%d\n%d",name[j],max,all);
    return 0;
    }

  • 0
    @ 2016-11-03 20:10:08
    var a,b,c,d,e,f,g,h,i,n,j,sum,max:longint;
        k:integer;
        s,s1,ss:string;
    begin
     readln(n);
     for i:=1 to n do
     begin
      h:=0;
      readln(s);
      s1:=copy(s,1,pos(' ',s)-1);
      delete(s,1,pos(' ',s));
      val(copy(s,1,pos(' ',s)-1),a,k);
      delete(s,1,pos(' ',s));
      val(copy(s,1,pos(' ',s)-1),b,k);
      delete(s,1,pos(' ',s));
      if s[1]='Y' then c:=1 else c:=0;
      delete(s,1,2);
      if s[1]='Y' then d:=1 else d:=0;
      delete(s,1,2);
      val(copy(s,1,length(s)),e,k);
      if (a>80) and (e>0) then inc(h,8000);
      if (a>85) and (b>80) then inc(h,4000);
      if (a>90) then inc(h,2000);
      if (a>85) and (d=1) then inc(h,1000);
      if (b>80) and (c=1) then inc(h,850);
      inc(sum,h);
      //writeln(a,' ',b,' ',c,' ',d,' ',e,' ',h);
      if h>max then begin max:=h; ss:=s1; end;
     end;
     writeln(ss);
     writeln(max);
     writeln(sum);
    end.
    
  • 0
    @ 2016-10-31 20:29:54

    #include <iostream>
    using namespace std;

    struct student{
    char name[30],g,w;
    int q,b,p;
    }a[120];

    int main(){
    freopen("in.txt","r",stdin);
    int n,sum[120]={0},maxw=-1,num,total=0;
    cin>>n;
    for(int i=1;i<=n;i++)
    cin>>a[i].name>>a[i].q>>a[i].b>>a[i].g>>a[i].w>>a[i].p;
    for(int i=1;i<=n;i++){
    if(a[i].q>80&&a[i].p>=1)
    sum[i]+=8000;
    if(a[i].q>85&&a[i].b>80)
    sum[i]+=4000;
    if(a[i].q>90)
    sum[i]+=2000;
    if(a[i].q>85&&a[i].w=='Y')
    sum[i]+=1000;
    if(a[i].b>80&&a[i].g=='Y')
    sum[i]+=850;
    }
    for(int i=1;i<=n;i++){
    total+=sum[i];
    if(sum[i]>maxw){
    num=i;
    maxw=sum[i];
    }
    }

    cout<<a[num].name<<endl<<sum[num]<<endl<<total;
    return 0;
    }

  • 0
    @ 2016-10-30 16:55:31

    type jxj=record
    xm:string[20];
    qm:0..100;
    bj:0..100;
    gb:char;
    xb:char;
    lw:0..20;
    zqs:longint;
    xs:longint;
    end;
    var maxzqs,zjxjs,i,j,k,l,m,n:longint;
    a:array[1..1000]of jxj;
    ch:char;
    begin
    readln(n);
    for i:=1 to n do
    begin
    read(ch);
    if ch<>' 'then a[i].xm
    for i:=1 to n do
    with a[i] do
    begin
    read(qm);
    read(bj);
    read(gb);
    read(xb);
    read(lw);
    end;
    for i:=1 to n do
    with a[i] do
    begin
    writeln(xm);
    writeln(qm);
    writeln(bj);
    writeln(gb);
    writeln(xb);
    writeln(lw);
    end;
    end.

  • 0
    @ 2016-10-27 11:03:05

    var best,name:string[20];
    qimo,py,maxta,tal,i,n,ta,j,lunw:longint;
    gb,xb:char;
    procedure readin;
    var q:char;
    begin
    name:='';
    for j:=1 to 20 do
    begin
    read(q);
    if q<>' ' then
    name:=name+q
    else break;
    end;
    end;
    begin
    assign(input,'scholar9.in');assign(output,'schola.out');
    reset(input);rewrite(output);
    readln(n);
    maxta:=0;
    tal:=0;
    for i:=1 to n do
    begin
    readin;
    ta:=0;
    read(qimo,py);read(gb);read(gb);read(xb);read(xb);
    read(lunw);
    readln;
    if (qimo>80)and(lunw>=1) then inc(ta,8000);
    if (qimo>85)and(py>80) then inc(ta,4000);
    if (qimo>90) then inc(ta,2000);
    if (qimo>85)and(xb='Y') then inc(ta,1000);
    if (py>80)and(gb='Y') then inc(ta,850);inc(tal,ta);
    if ta>maxta then
    begin
    maxta:=ta;
    best:=name;
    end;
    end;
    writeln(best);
    writeln(maxta);
    writeln(tal);
    close(input);close(output);
    end.

  • 0
    @ 2016-10-26 21:54:19
    #include<iostream>
    using namespace std;
    int main()
    {
        int a,b,e,i,max=0,m[1000]={0},n,x,money=0;string s,name;char c,d;
        cin>>n;
        for(i=1;i<=n;i++)
        {
            cin>>name>>a>>b>>c>>d>>e;
            if(a>80&&e>0)
                m[i]+=8000;
            if(a>85&&b>80)
                m[i]+=4000;
            if(a>90)
                m[i]+=2000;
            if(d=='Y'&&a>85)
                m[i]+=1000;
            if(c=='Y'&&b>80)
                m[i]+=850;
            if(m[i]>max)
                s=name,max=m[i];
        }
        for(i=1;i<=n;i++)
            money+=m[i];
        cout<<s<<endl<<max<<endl<<money;
    return 0;
    }
    

  • 0
    @ 2016-10-23 22:27:58
    #include<iostream>
    #include<cstdio>
    using namespace std;
    struct node{
        char name[25],ganb,xib;
        int qimo,banp,art,score;
    }man[105];
    int n;
    int main(){
        int i,ans=0,sum=0,res;
        scanf("%d",&n);
        for(i=1;i<=n;i++){
            man[i].score=0;
        }
        for(i=1;i<=n;i++){
            cin>>man[i].name>>man[i].qimo>>man[i].banp>>man[i].ganb;
            cin>>man[i].xib>>man[i].art;
        }
        for(i=1;i<=n;i++){
            if(man[i].qimo>80&&man[i].art>=1){
                man[i].score+=8000;
            }
            if(man[i].qimo>85&&man[i].banp>80){
                man[i].score+=4000;
            }
            if(man[i].qimo>90){
                man[i].score+=2000;
            }
            if(man[i].qimo>85&&man[i].xib=='Y'){
                man[i].score+=1000;
            }
            if(man[i].banp>80&&man[i].ganb=='Y'){
                man[i].score+=850;
            }
        }
        for(i=1;i<=n;i++){
            if(man[i].score>ans){
                ans=man[i].score;
                res=i;
            }
            sum+=man[i].score;
        }
        cout<<man[res].name<<endl<<ans<<endl<<sum<<endl;
        return 0;
    }
    
  • 0
    @ 2016-10-20 20:20:35

    #include<iostream>
    #include<cstdio>
    #include<vector>
    #include<cmath>
    #include<algorithm>
    #include<string>
    #include<set>
    #include<map>
    #include<ctime>
    #include<cstring>
    #include<cassert>
    #include<bitset>
    #include<sstream>
    #include<queue>
    using namespace std;
    struct xs
    {
    string name;
    int cj;
    int py;
    char bgb;
    char xb;
    int lw;
    int jxj;
    };

    int main()
    {
    int rs,i,j;
    cin>>rs;
    xs a[rs];
    for(i=0;i<rs;i++)
    {
    cin>>a[i].name;
    cin>>a[i].cj;
    cin>>a[i].py;
    cin>>a[i].bgb;
    cin>>a[i].xb;
    cin>>a[i].lw;
    a[i].jxj=0;
    }
    for(i=0;i<rs;i++)
    {
    if(a[i].cj>80 && a[i].lw>=1) a[i].jxj+=8000;
    if(a[i].cj>85 && a[i].py>80) a[i].jxj+=4000;
    if(a[i].cj>90) a[i].jxj+=2000;
    if(a[i].xb=='Y' && a[i].cj>85) a[i].jxj+=1000;
    if(a[i].py>80 && a[i].bgb=='Y') a[i].jxj+=850;
    // cout<<a[i].jxj<<endl;
    }
    int sum=0;
    string na;
    int mx;
    mx=-1;
    for(i=0;i<rs;i++)
    {
    sum+=a[i].jxj;
    if(a[i].jxj>mx)
    {
    na=a[i].name;
    mx=a[i].jxj;
    }
    }
    cout<<na<<endl<<mx<<endl<<sum;
    return 0;
    }

  • 0
    @ 2016-10-15 21:32:23

    /*
    2016年10月15日21:03:45
    谁拿了最多奖学金
    https://vijos.org/p/1001

    */
    #include <iostream>
    #include <cstdio>
    #include <cstdlib>
    #include <cstring>
    #include <string>
    #include <algorithm>
    using namespace std;

    struct student
    {
    char name[10];
    int score;
    int pingyi;
    char leader;
    char west;
    int paper;
    };
    int main()
    {
    freopen("p1001.in", "r", stdin);
    int num;
    cin >> num;//学生个数
    int ans[num+1];//奖学金
    struct student stu[num+1];//学生
    memset(ans, 0, sizeof(ans));//初始化奖学金为零

    for(int i=1;i<=num;i++)//读入学生信息
    {
    cin >> stu[i].name;
    cin >> stu[i].score;
    cin >> stu[i].pingyi;
    cin >> stu[i].leader;
    cin >> stu[i].west;
    cin >> stu[i].paper;

    }
    for(int j=1;j<=num;j++)
    {
    if(stu[j].score > 80 && stu[j].paper >=1)
    ans[j] += 8000;
    if(stu[j].score > 85 && stu[j].pingyi > 80)
    ans[j] += 4000;
    if(stu[j].score > 90)
    ans[j] += 2000;
    if(stu[j].west == 'Y' && stu[j].score > 85)
    ans[j] += 1000;
    if(stu[j].pingyi > 80 && stu[j].leader == 'Y')
    ans[j] += 850;
    }
    int max = 0;//记录最大值
    int flag;//记录第几个学生最大
    for(int i=1;i<=num;i++)
    {
    if(ans[i] > max)
    {
    max = ans[i];
    flag = i;
    }
    }
    int total=0;//记录N个学生奖学金总数
    for(int j=1;j<=num;j++)
    total += ans[j];

    cout << stu[flag].name << endl;
    cout << max << endl;
    cout << total << endl;

    /* for(int i=1;i<=num;i++)
    {
    cout << stu[i].name << endl;
    cout << stu[i].score << endl;
    cout << stu[i].pingyi << endl;
    cout << stu[i].leader << endl;
    cout << stu[i].west << endl;
    cout << stu[i].paper << endl;
    }
    */

    return 0;
    }

  • 0
    @ 2016-10-14 11:46:28
    #include<iostream>
    #include<cstring>
    #include<algorithm>
    #include<string>
    using namespace std;
    int tot=0,n;
    struct NodeT{
        string name;
        int qm,bp,lwn,reward;
        char xg,xs;
    }node[105];//结构体node存数据
    
    /*bool comp(NodeT x,NodeT y){
        if(x.reward!=y.reward)return x.reward>y.reward;
        return x.name<y.name;
    }比较函数 (不需要)delete
    */ 
    void solve(){
        for(int i=1;i<=n;i++){
            node[i].reward=0;
            if(node[i].qm>80&&node[i].lwn>=1)node[i].reward+=8000;
            if(node[i].qm>85&&node[i].bp>80)node[i].reward+=4000;
            if(node[i].qm>90)node[i].reward+=2000;
            if(node[i].qm>85&&node[i].xs=='Y')node[i].reward+=1000;
            if(node[i].bp>80&&node[i].xg=='Y')node[i].reward+=850;
        }//逐个输入
        node[0].reward=0;//***初始化为零*** 打擂 求出最大值
        for(int i=1;i<=n;i++)
        {
            if(node[i].reward>node[0].reward)
            {
                node[0].name=node[i].name;
                node[0].reward=node[i].reward;
            }
            tot+=node[i].reward;//求和
        }
        cout<<node[0].name<<endl<<node[0].reward<<endl<<tot<<endl;//输出
    }
    
    int main(){
        cin>>n;
        for(int i=1;i<=n;i++)cin>>node[i].name>>node[i].qm>>node[i].bp>>node[i].xg>>node[i].xs>>node[i].lwn;
        solve();
        return 0;
    }
    
  • 0
    @ 2016-10-05 10:05:15
    #include <iostream>
    #include <string>
    #include <cstring>
    using namespace std;
    
    struct student
    {
        string name;
        int final_score;
        int class_score;
        bool boss;
        bool west;
        int artical;
        int money;  
    };
    student stu[102];
    
    int main()
    {
        int n;
        cin >> n;
        char is_boss, is_west;
        int most_money = 0, most_name = 0, total = 0;
        for (int i = 1; i <= n; ++i)
        {
            cin >> stu[i].name;
            cin >> stu[i].final_score;
            cin >> stu[i].class_score;
            cin >> is_boss;
            stu[i].boss = (is_boss == 'Y') ? true : false;
            cin >> is_west;
            stu[i].west = (is_west == 'Y') ? true : false;
            cin >> stu[i].artical;
            stu[i].money = 0;   
            if (stu[i].final_score > 80 && stu[i].artical >= 1)
                stu[i].money += 8000;
            if (stu[i].final_score > 85 && stu[i].class_score > 80)
                stu[i].money += 4000;
            if (stu[i].final_score > 90)
                stu[i].money += 2000;
            if (stu[i].west && stu[i].final_score > 85)
                stu[i].money += 1000;
            if (stu[i].boss && stu[i].class_score > 80)
                stu[i].money += 850;
            total += stu[i].money;
            if (stu[i].money > most_money)
            { 
                most_name = i;
                most_money = stu[i].money;
            }
        }
        cout << stu[most_name].name << endl;
        cout << stu[most_name].money << endl;
        cout << total << endl;
        return 0;
    }
    
  • 0
    @ 2016-09-11 16:31:22

    #include<iostream>
    using namespace std;
    int main(){
    int a;
    cin>>a;
    int s1[a],s2[a],b[a],m1[a],sum=0,m2[a];
    string n[a],g[a],x[a];
    for (int i=0;i<a;i++){
    cin>>n[i]>>s1[i]>>s2[i]>>g[i]>>x[i]>>b[i];
    m1[i]=0;
    if (s1[i]>80&&b[i]>0)
    m1[i]+=8000;
    if (s1[i]>85&&s2[i]>80)
    m1[i]+=4000;
    if (s1[i]>90)
    m1[i]+=2000;
    if (s1[i]>85&&x[i]=="Y")
    m1[i]+=1000;
    if (s2[i]>80&&g[i]=="Y")
    m1[i]+=850;
    sum+=m1[i];
    m2[i]=m1[i];
    }
    for (int i=0;i<a-1;i++){
    if (m1[i]>=m1[i+1])
    m1[i+1]=m1[i];
    }
    for (int i=0;i<a;i++){
    if (m2[i]==m1[a-1]){
    cout<<n[i]<<endl;
    break;
    }
    }
    cout<<m1[a-1]<<endl;
    cout<<sum<<endl;
    }

信息

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