518 条题解

  • 0
    @ 2015-10-09 19:03:37

    简直水
    #include <cstdio>
    #include <string>
    #include <cstring>
    #include <iostream>
    #include <algorithm>
    using namespace std;

    string na[105];
    char A,B;
    bool gb[105],xb[105];
    int lw[105],jf[105],pc[105],sum;
    int n,i,jxj[105],pm[105],temp,j;

    int main()
    {
    cin>>n;
    for (i=1;i<=n;i++)
    {
    cin>>na[i]>>jf[i]>>pc[i]>>A>>B>>lw[i];
    if (A=='N') gb[i]=false;
    else gb[i]=true;
    if (B=='N') xb[i]=false;
    else xb[i]=true;
    pm[i]=i;
    }
    for (i=1;i<=n;i++)
    {
    if (jf[i]>80 && lw[i]>=1) jxj[i]+=8000; //院士奖学金
    if (jf[i]>85 && pc[i]>80) jxj[i]+=4000; //五四奖学金
    if (jf[i]>90) jxj[i]+=2000; //成绩优秀奖
    if (jf[i]>85 && xb[i]) jxj[i]+=1000; //西部奖学金
    if (pc[i]>80 && gb[i]) jxj[i]+=850; //班级贡献奖
    sum+=jxj[i];
    }
    for (i=1;i<n;i++)
    for (j=i+1;j<=n;j++)
    {
    if (jxj[i]<jxj[j]) {
    temp=pm[i];pm[i]=pm[j];pm[j]=temp;
    temp=jxj[i];jxj[i]=jxj[j];jxj[j]=temp;
    }
    if (jxj[i]==jxj[j] && pm[i]>pm[j]) {
    temp=pm[i];pm[i]=pm[j];pm[j]=temp;
    temp=jxj[i];jxj[i]=jxj[j];jxj[j]=temp;
    }
    }
    cout<<na[pm[1]]<<endl<<jxj[1]<<endl<<sum<<endl;
    }

  • 0
    @ 2015-09-12 12:53:40

    #include <cstdio>
    #include <cstring>

    struct Person
    {
    char name[21];
    int id;
    int prize;
    } person[100] = {"\0", 0, 0};

    int main(void)
    {
    char name[21] = "\0", job = '\0', west = '\0',
    Mnam[21];
    int i, n, final, score, article, prize, max = 0, total = 0;

    scanf("%d", &n);
    for (i = 0; i < n; ++i)
    {
    scanf("%s %d %d %c %c %d", name, &final, &score, &job, &west, &article);
    prize = 0;
    if (final > 80)
    {
    if (article > 0)
    {
    prize += 8000;
    }
    if (final > 85)
    {
    if (score > 80)
    {
    prize += 4000;
    }
    if (final > 90)
    {
    prize += 2000;
    }
    if (west == 'Y')
    {
    prize += 1000;
    }
    }
    }
    if (score > 80 && job == 'Y')
    {
    prize += 850;
    }
    total += prize;
    if ((!i) || prize > max)
    {
    strcpy(Mnam, name);
    max = prize;
    }
    }
    printf("%s\n%d\n%d", Mnam, max, total);
    return 0;
    }

  • 0
    @ 2015-09-12 10:35:44

    /login be8889f1

  • 0
    @ 2015-07-20 11:48:35

    #include <iostream>
    #include <string>
    using namespace std;
    int main(){
    int a,b=0,c=0;
    string d;
    cin >> a;
    while (a != 0){
    string e, f, g;
    int h, i, j, k;
    cin >> e >> h >> i >> f >> g >> j;
    k = (h > 80 && j >= 1 ? 8000 : 0) +
    (h > 85 && i > 80 ? 4000 : 0) +
    (h > 90 ? 2000 : 0) +
    (h > 85 && g == "Y" ? 1000 : 0) +
    (i > 80 && f == "Y" ? 850 : 0);
    b += k;
    if (k > c){
    c = k;
    d = e;
    }
    a--;
    }
    cout << d << endl;
    cout << c << endl;
    cout << b << endl;;
    return 0;
    }

  • 0
    @ 2015-07-20 11:44:25

    #include <iostream>
    #include <string>
    using namespace std;
    int main(){
    int 学生的总数,学金的总数=0,获得的奖金最多=0;
    string 获得最多奖金的学生的姓名;
    cin >> 学生的总数;
    while (学生的总数 != 0){
    string 姓名, 是否是学生干部, 是否是西部省份学生;
    int 期末平均成绩, 班级评议成绩, 发表的论文数, 学金;
    cin >> 姓名 >> 期末平均成绩 >> 班级评议成绩 >> 是否是学生干部 >> 是否是西部省份学生 >> 发表的论文数;
    学金 = (期末平均成绩 > 80 && 发表的论文数 >= 1 ? 8000 : 0) +
    (期末平均成绩 > 85 && 班级评议成绩 > 80 ? 4000 : 0) +
    (期末平均成绩 > 90 ? 2000 : 0) +
    (期末平均成绩 > 85 && 是否是西部省份学生 == "Y" ? 1000 : 0) +
    (班级评议成绩 > 80 && 是否是学生干部 == "Y" ? 850 : 0);
    学金的总数 += 学金;
    if (学金 > 获得的奖金最多){
    获得的奖金最多 = 学金;
    获得最多奖金的学生的姓名 = 姓名;
    }
    学生的总数--;
    }
    cout << 获得最多奖金的学生的姓名 << endl;
    cout << 获得的奖金最多 << endl;
    cout << 学金的总数 << endl;
    return 0;
    }

  • 0
    @ 2015-07-19 08:30:54

    #include<stdio.h>
    int main()
    {
    int n,i,j,all=0;
    scanf("%d",&n);
    struct student
    {
    char a[30],bg,xb;
    int qm,by,lw,m;
    }stu[n+10];
    for(i=1;i<=n;i++)
    {
    scanf("%s %d %d %c %c %d",stu[i].a,&stu[i].qm,&stu[i].by,&stu[i].bg,&stu[i].xb,&stu[i].lw);
    stu[i].m=0;
    }

    for(i=1;i<=n;i++)
    {
    if(stu[i].qm>80&&stu[i].lw>=1)
    stu[i].m=stu[i].m+8000;
    if(stu[i].qm>85&&stu[i].by>80)
    stu[i].m=stu[i].m+4000;
    if(stu[i].qm>90)
    stu[i].m=stu[i].m+2000;
    if(stu[i].qm>85&&stu[i].xb=='Y')
    stu[i].m=stu[i].m+1000;
    if(stu[i].by>80&&stu[i].bg=='Y')
    stu[i].m=stu[i].m+850;
    }
    stu[0]=stu[1];
    for(i=1;i<=n;i++)
    {
    if(stu[0].m<stu[i].m)
    stu[0]=stu[i];
    all=all+stu[i].m;
    }
    printf("%s\n%d\n%d",stu[0].a,stu[0].m,all);
    return 0;
    }

    • @ 2015-10-07 17:18:50

      你代码中的'stu[0]=stu[1];'这一行的目的是什么?

  • 0
    @ 2015-07-12 11:54:07

    #include"iostream"
    #include<cstdio>
    #include<cmath>
    using namespace std;
    typedef long long ll;
    const int N=105;
    struct node{
    char name[21];
    int endsc;
    int classsc;
    char ganbu;
    char bibei;
    int storys;
    int award;
    };
    int n;
    node stu[N];
    ll ans;
    int maxn=-1;
    int k=-1;
    void money(node &child,int i)
    {
    child.award=0;
    if(child.endsc>80&&child.storys>=1)
    child.award+=8000;
    if(child.endsc>85&&child.classsc>80)
    child.award+=4000;
    if(child.endsc>90)
    child.award+=2000;
    if(child.endsc>85&&child.bibei=='Y')
    child.award+=1000;
    if(child.ganbu=='Y'&&child.classsc>80)
    child.award+=850;
    if(child.award>maxn)
    {
    maxn=child.award;
    k=i;
    }
    ans+=child.award;
    }
    int main()
    {
    cin>>n;
    for(int i=0;i<n;i++)
    {
    cin>>stu[i].name;
    cin>>stu[i].endsc;
    cin>>stu[i].classsc;
    cin>>stu[i].ganbu;
    cin>>stu[i].bibei;
    cin>>stu[i].storys;

    }
    for(int i=0;i<n;i++)
    money(stu[i],i);
    cout<<stu[k].name<<endl;
    cout<<maxn<<endl;
    cout<<ans;

    return 0;
    }

  • 0
    @ 2015-06-06 14:05:18

    测试数据 #0: Accepted, time = 0 ms, mem = 492 KiB, score = 10
    测试数据 #1: Accepted, time = 0 ms, mem = 492 KiB, score = 10
    测试数据 #2: Accepted, time = 1 ms, mem = 488 KiB, score = 10
    测试数据 #3: Accepted, time = 0 ms, mem = 492 KiB, score = 10
    测试数据 #4: Accepted, time = 0 ms, mem = 488 KiB, score = 10
    测试数据 #5: Accepted, time = 0 ms, mem = 492 KiB, score = 10
    测试数据 #6: Accepted, time = 0 ms, mem = 488 KiB, score = 10
    测试数据 #7: Accepted, time = 15 ms, mem = 492 KiB, score = 10
    测试数据 #8: Accepted, time = 2 ms, mem = 492 KiB, score = 10
    测试数据 #9: Accepted, time = 0 ms, mem = 492 KiB, score = 10
    #include <cstdio>
    #include <cstring>
    using namespace std;
    int main(){
    freopen("input.txt","r",stdin);
    char s[100][20],c1,c2;
    int n,sum=0,max=0,score1,score2,num,a,b,ans1;
    scanf("%d",&n);
    for (int i=1;i<=n;i++){
    scanf("%s %d %d %c %c %d",&s[i],&score1,&score2,&c1,&c2,&num);
    a=c1=='Y'?1:0;
    b=c2=='Y'?1:0;
    int tmp=0;
    if ((score1>80)&&(num>0)) tmp+=8000;
    if ((score1>85)&&(score2>80)) tmp+=4000;
    if (score1>90) tmp+=2000;
    if (b&&(score1>85)) tmp+=1000;
    if (a&&(score2>80)) tmp+=850;
    sum+=tmp;
    if (tmp>max) {max=tmp;ans1=i;}
    }
    printf("%s\n%d\n%d\n",s[ans1],max,sum);
    return 0;

    }

    刚学c++

  • 0
    @ 2015-06-05 20:44:13

    水题
    program p1001;
    var mz,mz1:string;
    n,i,qm,bj,lw,max,jxj:integer;
    he:longint;
    gb,xb:boolean;
    c:char;
    begin
    readln(n);
    he:=0;
    max:=0;
    for i:=1 to n do
    begin
    jxj:=0;
    read(c);
    mz:='';
    while c<>' ' do
    begin
    mz:=mz+c;
    read(c);
    end;
    read(qm,bj);
    if (qm>85) and (bj>80) then jxj:=jxj+4000;
    if qm>90 then jxj:=jxj+2000;
    read(c);
    read(c);
    if c='Y' then gb:=true
    else gb:=false;
    if (bj>80) and gb then jxj:=jxj+850;
    read(c);
    read(c);
    if c='Y' then xb:=true
    else xb:=false;
    if (qm>85) and xb then jxj:=jxj+1000;
    readln(lw);
    if (qm>80) and (lw>0) then jxj:=jxj+8000;
    he:=he+jxj;
    if jxj>max then
    begin
    mz1:=mz;
    max:=jxj;
    end;
    end;
    writeln(mz1);
    writeln(max);
    writeln(he);
    end.

  • 0
    @ 2015-05-01 20:46:20

    pascal语言轻松AC
    var name:array[1..100] of string;
    a1,a2,a5:array[1..100] of longint;
    a3,a4:array[1..100] of char;
    n,i,max,total,p:longint;
    maxname:string;
    ch:char;
    f:text;
    begin
    readln(n);
    for i:=1 to n do
    begin
    read(ch);
    while ch<>' ' do
    begin
    name[i]:=name[i]+ch;
    read(ch);
    end;
    readln(a1[i],a2[i],ch,a3[i],ch,a4[i],ch,a5[i]);
    end;
    for i:=1 to n do
    begin
    p:=0;
    if (a1[i]>80) and (a5[i]>=1) then inc(p,8000);
    if (a1[i]>85) and (a2[i]>80) then inc(p,4000);
    if (a1[i]>90) then inc(p,2000);
    if (a1[i]>85) and (a4[i]='Y') then inc(p,1000);
    if (a2[i]>80) and (a3[i]='Y') then inc(p,850);
    if p>max then
    begin
    max:=p;
    maxname:=name[i];
    end;
    inc(total,p);
    end;
    writeln(maxname);
    writeln(max);
    writeln(total);
    end.

  • 0
    @ 2015-04-02 16:03:32

    const maxn=100;
    type node=record
    name:string;
    score1,score2,cnt,money:longint;
    flag1,flag2:boolean;
    end;
    var i,j,k,m,n,tot,ans,kk,max:longint;
    inf:array[1..maxn] of node;
    s,ts:string;
    begin
    assign(input,'1001.in');reset(input);
    //assign(output,'.out');rewrite(output);

    readln(n);
    for i:=1 to n do begin
    readln(s);
    s:=s+' ';
    ts:='';tot:=0;
    for j:=1 to length(s) do begin
    if s[j]=' ' then begin
    inc(tot);
    case tot of
    1:inf[i].name:=ts;
    2:val(ts,inf[i].score1);
    3:val(ts,inf[i].score2);
    4:if ts='Y' then
    inf[i].flag1:=true;
    5:if ts='Y' then
    inf[i].flag2:=true;
    6:val(ts,inf[i].cnt);

    end;

    ts:='';
    continue;
    end;
    ts:=ts+s[j];
    end;
    end;

    max:=0;ans:=0;
    for i:=1 to n do begin
    if (inf[i].score1>80) and (inf[i].cnt>0) then
    inc(inf[i].money,8000);
    if (inf[i].score1>85) and (inf[i].score2>80) then
    inc(inf[i].money,4000);
    if (inf[i].score1>90) then
    inc(inf[i].money,2000);
    if (inf[i].score1>85) and (inf[i].flag2) then
    inc(inf[i].money,1000);
    if (inf[i].score2>80) and (inf[i].flag1) then
    inc(inf[i].money,850);
    inc(ans,inf[i].money);
    if inf[i].money>max then begin
    max:=inf[i].money;
    kk:=i;
    end;
    end;
    writeln(inf[kk].name);
    writeln(max);
    writeln(ans);
    end.

  • 0
    @ 2015-03-29 16:56:14

    处女贴,嗯这只是个测试(
    ```C++
    #include <iostream>
    using namespace std;
    #define is(x) (x-'N')

    int main(void){
    int count;
    cin >> count;
    string names[count];
    unsigned cash, exam, eone, paper, maxcash=0, who;
    long total;
    char work, west;
    for (int i=0; i<count; i++) {
    cash = 0;
    cin >> names[i] >> exam >> eone >> work >> west >> paper;

    if (exam>80 && paper) cash+=8000;
    if (exam>85 && eone>80) cash+=4000;
    if (exam>90) cash+=2000;
    if (exam>85 && is(west)) cash+=1000;
    if (eone>80 && is(work)) cash+=850;

    if (cash>maxcash) {
    who = i;
    maxcash=cash;
    }
    total+=cash;
    }
    cout << names[who] << endl << maxcash << endl << total;
    return 0;
    }
    ```

  • 0
    @ 2015-03-18 11:03:26

    #include <iostream>
    #include <algorithm>
    #include <cstdio>
    using namespace std;
    struct student
    {
    string name;
    int score,classscore,passage,money;
    char cadre,weststudent;
    }S[105];
    bool compare(student a,student b){return a.money<b.money;}
    int main()
    {
    int n,ans=0;
    scanf("%d",&n);
    for(int i=0;i<n;i++) cin>>S[i].name>>S[i].score>>S[i].classscore>>S[i].cadre>>S[i].weststudent>>S[i].passage;
    for(int i=0;i<n;i++)
    {
    S[i].money=0;
    if(S[i].score>80&&S[i].passage>0) S[i].money+=8000;
    if(S[i].score>85&&S[i].classscore>80) S[i].money+=4000;
    if(S[i].score>90) S[i].money+=2000;
    if(S[i].score>85&&S[i].weststudent=='Y') S[i].money+=1000;
    if(S[i].classscore>80&&S[i].cadre=='Y') S[i].money+=850;
    ans+=S[i].money;
    }
    student t=*max_element(S,S+n,compare);
    cout<<t.name<<endl<<t.money<<endl<<ans;
    return 0;
    }

  • 0
    @ 2015-02-16 21:19:21

    #include<iostream>
    #include<cstdio>
    #include<cstring>
    #include<algorithm>
    using namespace std;
    const int maxn=105;
    int numn,sum=0;
    struct student
    {
    char n[23];
    int num;
    int qm;
    int py;
    bool gb;
    bool xb;
    int lw;
    int jj;
    student(){memset(n,0,sizeof(n));jj=0;gb=false;xb=false;}
    };student k[maxn];
    void judge(int cur)
    {
    if(k[cur].qm>80&&k[cur].lw>0)k[cur].jj+=8000;
    if(k[cur].qm>85&&k[cur].py>80)k[cur].jj+=4000;
    if(k[cur].qm>90)k[cur].jj+=2000;
    if(k[cur].qm>85&&k[cur].xb)k[cur].jj+=1000;
    if(k[cur].py>80&&k[cur].gb)k[cur].jj+=850;
    sum+=k[cur].jj;
    }
    bool cmp(student a,student b)
    {
    if(a.jj>b.jj)return true;
    else if(a.jj==b.jj)return a.num<b.num;
    else return false;
    }
    int main()
    {
    scanf("%d",&numn);
    for(int i=1;i<=numn;i++)
    {
    scanf("\n");
    k[i].num=i;
    scanf("%s%d%d",k[i].n,&k[i].qm,&k[i].py);
    char a,b;
    scanf(" %c %c%d",&a,&b,&k[i].lw);
    if(a=='Y')k[i].gb=true;if(b=='Y')k[i].xb=true;
    judge(i);
    }
    sort(k+1,k+1+numn,cmp);
    if(k[1].jj)
    printf("%s\n%d\n%d\n",k[1].n,k[1].jj,sum);
    return 0;
    }

  • 0
    @ 2015-02-09 23:14:58

    var n,i,j,k,l,max:longint;
    b,c,f,g:array [1..100] of integer;
    a,d,e:array [1..100] of string;
    s,t,st:string;
    begin
    readln(n);
    for i:=1 to n do
    begin
    readln(s);
    l:=pos(' ',s);
    a[i]:=copy(s,1,l-1);
    delete(s,1,l);
    l:=pos(' ',s);
    t:=copy(s,1,l-1);
    val(t,b[i]);
    delete(s,1,l);
    l:=pos(' ',s);
    t:=copy(s,1,l-1);
    val(t,c[i]);
    delete(s,1,l);
    l:=pos(' ',s);
    d[i]:=copy(s,1,l-1);
    delete(s1l);
    l:=pos(' ',s);
    e[i]:=copy(s,1,l-1);
    delete(s,1,l);
    val(s,f[i]);
    end;
    end;

    fillchar(gsizeof(g),0);
    for i:=1 to n do
    begin
    if (b[i]>80) and (f[i]>=1) then inc(g[i],8000);
    if (b[i]>85) and (c[i]>80) then inc(g[i],4000);
    if (b[i]>90) then inc(g[i],2000);
    if (b[i]>85) and (e[i]='Y') then inc(g[i],1000);
    if (c[i]>80) and (d[i]='Y') then inc(g[i]850);
    end;
    max:=0;
    l:=0;
    for i:=1 to n do
    begin
    l:=l+g[i];
    if g[i]>max then
    begin
    max:=g[i];
    st:=a[i];
    end;
    end;
    writeln(st);
    writeln(max);
    writeln(l);
    end.

  • 0
    @ 2015-02-01 09:16:32

    var
    max,n,sum1,sum,qm,py,i,p,lw:longint;
    f1,f2:boolean;
    xm,xm1,st:string;
    begin
    readln(n); max:=0;
    for i:=1 to n do
    begin
    readln(st); f1:=false;f2:=false;st:=st+' ';sum1:=0;
    p:=pos(' ',st);
    xm:=copy(st,1,p-1);delete(st,1,p);p:=pos(' ',st);
    val(copy(st,1,p-1),qm);delete(st,1,p);p:=pos(' ',st);
    val(copy(st,1,p-1),py);delete(st,1,p);p :=pos(' ',st);
    if copy(st,1,1)='Y' then f1:=true;delete(st,1,p);p:=pos(' ',st);
    if copy(st,1,1)='Y' then f2:=true;delete(st,1,p);p:=pos(' ',st);
    val(copy(st,1,p-1),lw);
    if (qm>80) and (lw>=1) then sum1:=sum1+8000;
    if (qm>85) and (py>80) then sum1:=sum1+4000;
    if qm>90 then sum1:=sum1+2000;
    if (qm>85) and (f2=true) then sum1:=sum1+1000;
    if (py>80) and (f1=true) then sum1:=sum1+850;
    if sum1>max then begin max:=sum1;xm1:=xm;end;sum:=sum+sum1;
    end;
    writeln(xm1);writeln(max);writeln(sum);
    end.

  • 0
    @ 2015-02-01 08:57:37

    var n,i,a,b,c,ans,j,k:longint;
    s:array[0..100] of string;
    sum,k2:array[0..100] of longint;
    b1,b2:char;
    s1,s2:string;
    begin
    readln(n);
    for i:=1 to n do
    begin
    readln(s1); s1:=s1+' ';
    s[i]:='';k:=1;

    while s1[k]<>' ' do
    begin
    s[i]:=s[i]+s1[k];
    inc(k);
    end;
    inc(k);s2:='';

    while s1[k]<>' ' do
    begin
    s2:=s2+s1[k];
    inc(k);
    end;

    val(s2,a);s2:='';inc(k);
    while s1[k]<>' ' do
    begin
    s2:=s2+s1[k];
    inc(k);
    end;

    val(s2,b);s2:='';
    b1:=s1[k+1]; b2:=s1[k+3]; inc(k,5);

    while s1[k]<>' ' do
    begin
    s2:=s2+s1[k];
    inc(k);
    end;
    val(s2,c);

    sum[i]:=0; k2[i]:=i;
    if (a>80) and (c>=1) then inc(sum[i],8000);
    if (a>85) and (b>80) then inc(sum[i],4000);
    if (a>90) then inc(sum[i],2000);
    if (a>85) and (b2='Y') then inc(sum[i],1000);
    if (b>80) and (b1='Y') then inc(sum[i],850);
    inc(ans,sum[i]);
    end;
    for i:=1 to n-1 do
    for j:=i+1 to n do
    if (sum[i]<sum[j]) or ((sum[i]=sum[j]) and (k2[i]>k2[j])) then
    begin
    sum[0]:=sum[i]; sum[i]:=sum[j]; sum[j]:=sum[0];
    k2[0]:=k2[i]; k2[i]:=k2[j]; k2[j]:=k2[0];
    s[0]:=s[i]; s[i]:=s[j]; s[j]:=s[0];
    end;
    writeln(s[1]);
    writeln(sum[1]);
    writeln(ans);
    end.

  • 0
    @ 2015-01-09 20:04:27

    type aa=record
    name:string;
    qi,ban,lun:integer;
    xu,xi:char;
    fan:longint;

    end;
    var
    a:array[0..100]of aa;
    zong,l,r,m,n,x:int64;
    i,j:longint;
    s:string;

    BEGIN

    readln(n);zong:=0;
    for i:=1 to n do
    begin
    readln(s);
    a[i].name:=copy(s,1,pos(' ',s)-1);
    delete(s,1,pos(' ',s));
    val(copy(s,1,pos(' ',s)-1),a[i].qi);
    delete(s,1,pos(' ',s));
    val(copy(s,1,pos(' ',s)-1),a[i].ban);
    delete(s,1,pos(' ',s));
    a[i].xu:=s[1];
    a[i].xi:=s[3];
    a[i].lun:=ord(s[5])-48;
    end; m:=0;
    for i:=1 to n do
    begin
    if (a[i].qi>80) and (a[i].lun>=1) then inc(a[i].fan,8000);
    if (a[i].qi>85) and (a[i].ban>80) then inc(a[i].fan,4000);
    if a[i].qi>90 then inc(a[i].fan,2000);
    if (a[i].xi='Y') and (a[i].qi>85) then inc(a[i].fan,1000);
    if (a[i].ban>80) and (a[i].xu='Y') then inc(a[i].fan,850);
    m:=m+a[i].fan;
    if a[i].fan>a[zong].fan then zong:=i;
    end;
    writeln(a[zong].name);
    writeln(a[zong].fan);
    writeln(m);

    END.

  • 0
    @ 2014-12-27 19:58:09

    (:з」∠)这么多题都没见过几个Java的题解 还是发一发吧

    Block Code

    import java.util.Scanner;

    public class Main {
    static Scanner scanner = new Scanner(System.in);
    public static void main(String[] args) {
    int length = Integer.valueOf(scanner.nextLine());
    Object[] xingming = new Object[length], qimo = new Object[length],
    banji = new Object[length], ganbu = new Object[length],
    xibu = new Object[length], lunwen = new Object[length];
    int[] point = new int[length];
    for(int i = 0; i < length; i++) {
    String[] info = scanner.nextLine().split(" ");
    xingming[i] = String.valueOf(info[0]);
    qimo[i] = Integer.valueOf(info[1]);
    banji[i] = Integer.valueOf(info[2]);
    ganbu[i] = info[3].equals("Y") ? true : false;
    xibu[i] = info[4].equals("Y") ? true : false;
    lunwen[i] = Integer.valueOf(info[5]);
    }
    for(int i = 0; i < length; i++) {
    if((int)qimo[i] > 80 && (int)lunwen[i] >= 1)
    point[i] += 8000;
    if((int)qimo[i] > 85 && (int)banji[i] > 80)
    point[i] += 4000;
    if((int)qimo[i] > 90)
    point[i] += 2000;
    if((int)qimo[i] > 85 && (boolean)xibu[i])
    point[i] += 1000;
    if((int)banji[i] > 80 && (boolean)ganbu[i])
    point[i] += 850;
    }
    int temp = 0;
    int index = 0;
    int count = 0;
    for(int i = 0; i < length; i++) {
    if(point[i] > temp) {
    index = i;
    temp = point[i];
    }
    count += point[i];
    }
    System.out.println(xingming[index]);
    System.out.println(point[index]);
    System.out.println(count);
    }
    }

  • 0
    @ 2014-12-27 14:50:29

    简单是简单,就是你要细心

    c++ code

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

    struct str{
    int qm;
    int bj;
    bool gb;
    bool xb;
    int lw;
    };

    struct tj{
    string name;
    int num;
    };

    int pd(str s)
    {
    int ans=0;
    if (s.qm>80&&s.lw>=1) ans+=8000;
    if (s.qm>85&&s.bj>80) ans+=4000;
    if (s.qm>90) ans+=2000;
    if (s.xb==1&&s.qm>85) ans+=1000;
    if (s.gb==1&&s.bj>80) ans+=850;
    return ans;
    }

    bool comp(tj a,tj b)
    {
    return a.num>b.num;
    }
    int main()
    {
    char ch;
    vector<tj> a;
    str t;
    tj v;
    int n,i,k=1,ans=0;
    cin>>n;
    for (i=0;i!=n;i++)
    {
    cin>>v.name>>t.qm>>t.bj;
    cin>>ch;
    t.gb=ch=='Y'?1:0;
    cin>>ch;
    t.xb=ch=='Y'?1:0;
    cin>>t.lw;

    v.num=pd(t);
    a.push_back(v);
    }
    stable_sort(a.begin(),a.end(),comp);
    cout<<a[0].name<<endl<<a[0].num<<endl;
    for (i=0;i<n;i++)
    {
    ans+=a[i].num;
    }
    cout<<ans;
    return 0;
    }

信息

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