522 条题解

  • 0
    @ 2015-10-30 22:02:12

    果然是因为字符串数量弄错了。。。直接取30个解决。
    测试数据 #0: Accepted, time = 2 ms, mem = 496 KiB, score = 10

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

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

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

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

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

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

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

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

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

    Accepted, time = 6 ms, mem = 496 KiB, score = 100
    代码

    #include <stdio.h>
    int main()
    {
    int N, qimo, banji, lunwen, i = 0, I, moneyfinal = 0, moneytotal = 0;
    long money;
    char ganbu, xibu;
    char name[30], namefinal[30];
    scanf("%d", &N);
    do
    {
    i = i + 1;
    money = 0;
    scanf("%s %d %d %c %c %d", &name, &qimo, &banji, &ganbu, &xibu, &lunwen);
    if (((qimo > 80) && (lunwen != 0)) == 1) money = money + 8000;
    else;
    if (((qimo > 85) && (banji > 80)) == 1) money = money + 4000;
    else;
    if (qimo > 90) money = money + 2000;
    else;
    if (((qimo > 85) && (xibu == 'Y')) == 1) money = money + 1000;
    else;
    if (((banji > 80) && (ganbu == 'Y')) == 1) money = money + 850;
    else;
    moneytotal = moneytotal + money;
    if (money > moneyfinal)
    {
    moneyfinal = money;
    for (I = 0; I <= 30; I++) namefinal[I] = name[I];
    }
    else;
    }
    while (i < N);
    printf("%s\n%d\n%d", namefinal, moneyfinal, moneytotal);
    return 0;
    }

  • 0
    @ 2015-10-26 17:15:51

    浪费时间。。。。。好吧很水
    #include<stdio.h>
    #include<string.h>
    char s[25],z[25];
    int main()
    {
    int n,i,a,b,e,qian=0,he=0,zong=0;
    char c,d;
    scanf("%d",&n);
    scanf("%s%d%d %c %c%d",s,&a,&b,&c,&d,&e);
    if (a>80&&e>=1) he+=8000;
    if (a>85&&b>80) he+=4000;
    if (a>90)he+=2000;
    if (a>85&&d=='Y') he+=1000;
    if (b>80&&c=='Y') he+=850;
    strcpy(z,s);
    qian=he;
    zong=he;
    he=0;
    for (i=2;i<=n;i++)
    {
    scanf("%s%d%d %c %c%d",s,&a,&b,&c,&d,&e);
    if (a>80&&e>=1) he+=8000;
    if (a>85&&b>80) he+=4000;
    if (a>90)he+=2000;
    if (a>85&&d=='Y') he+=1000;
    if (b>80&&c=='Y') he+=850;
    if (he>qian)
    {qian=he;
    strcpy(z,s);}
    zong+=he;
    he=0;
    }
    printf("%s\n%d\n%d",z,qian,zong);
    return 0;
    }

  • 0
    @ 2015-10-25 14:08:13

    Free Pascal Compiler version 2.6.4 [2014/03/06] for i386
    Copyright (c) 1993-2014 by Florian Klaempfl and others
    Target OS: Win32 for i386
    Compiling foo.pas
    Linking foo.exe
    85 lines compiled, 0.0 sec , 29472 bytes code, 1628 bytes data
    测试数据 #0: Accepted, time = 0 ms, mem = 800 KiB, score = 10
    测试数据 #1: Accepted, time = 0 ms, mem = 804 KiB, score = 10
    测试数据 #2: Accepted, time = 0 ms, mem = 804 KiB, score = 10
    测试数据 #3: Accepted, time = 0 ms, mem = 800 KiB, score = 10
    测试数据 #4: Accepted, time = 4 ms, mem = 804 KiB, score = 10
    测试数据 #5: Accepted, time = 0 ms, mem = 800 KiB, score = 10
    测试数据 #6: Accepted, time = 0 ms, mem = 800 KiB, score = 10
    测试数据 #7: Accepted, time = 4 ms, mem = 800 KiB, score = 10
    测试数据 #8: Accepted, time = 0 ms, mem = 800 KiB, score = 10
    测试数据 #9: Accepted, time = 0 ms, mem = 804 KiB, score = 10
    Accepted, time = 8 ms, mem = 804 KiB, score = 100
    代码
    ##
    program p1001;
    type t1=record
    name:string;
    qimo:0..100;
    banji:0..100;
    ganbu:boolean;
    xibu:boolean;
    lunwen:boolean;
    end;
    var a:array[1..100]of t1;
    money:array[1..100]of longint;
    kong:array[1..5]of longint;
    str:string;
    n,i,j,k,whole:longint;
    function yuanshi(i:longint):boolean;
    begin
    if (a[i].qimo>80)and a[i].lunwen
    then exit(true) else exit(false);
    end;
    function wusi(i:longint):boolean;
    begin
    if (a[i].qimo>85)and(a[i].banji>80)
    then exit(true) else exit(false);
    end;
    function youxiu(i:longint):boolean;
    begin
    if (a[i].qimo>90)
    then exit(true) else exit(false);
    end;
    function xibujiang(i:longint):boolean;
    begin
    if (a[i].qimo>85)and a[i].xibu
    then exit(true) else exit(false);
    end;
    function banji(i:longint):boolean;
    begin
    if (a[i].banji>80)and a[i].ganbu
    then exit(true) else exit(false);
    end;
    begin
    readln(n);
    for i:=1 to n do
    begin
    readln(str);
    k:=0;
    for j:=1 to length(str) do
    if str[j]=' ' then
    begin
    inc(k);
    kong[k]:=j;
    end;
    a[i].name:=copy(str,1,kong[1]-1);
    val(copy(str,kong[1]+1,kong[2]-kong[1]-1),a[i].qimo,j);
    val(copy(str,kong[2]+1,kong[3]-kong[2]-1),a[i].banji,j);
    if str[kong[3]+1]='Y'
    then a[i].ganbu:=true
    else a[i].ganbu:=false;
    if str[kong[4]+1]='Y'
    then a[i].xibu:=true
    else a[i].xibu:=false;
    if str[kong[5]+1]='0'
    then a[i].lunwen:=false
    else a[i].lunwen:=true;
    end;
    fillchar(money,sizeof(money),0);
    whole:=0;
    for i:=1 to n do
    begin
    if yuanshi(i) then inc(money[i],8000);
    if wusi(i) then inc(money[i],4000);
    if youxiu(i) then inc(money[i],2000);
    if xibujiang(i) then inc(money[i],1000);
    if banji(i) then inc(money[i],850);
    inc(whole,money[i]);
    end;
    j:=0;k:=0;
    for i:=1 to n do
    if j<money[i] then
    begin
    j:=money[i];
    k:=i;
    end;
    writeln(a[k].name);
    writeln(money[k]);
    writeln(whole);
    end.

  • 0
    @ 2015-10-12 21:40:28

    在vs上亲测可效,不过到了这边一直报错strcyp()没声明

    #include<iostream>
    #include<string>

    using namespace std;

    int main()
    {
    int n, qm, bj, i;
    int max = 0,total=0;
    char yn1, yn2,Name[20],name[20];
    cin >> n;
    for (int j = 1; j <= n; j++)
    {
    int jxj = 0;
    cin >> name >> qm >> bj >> yn1 >> yn2 >> i;
    if (qm > 80 && i >= 1)
    {
    jxj = jxj + 8000;
    }
    if (qm > 85 && bj > 80)
    {
    jxj = jxj + 4000;
    }
    if (qm > 90)
    {
    jxj = jxj + 2000;
    }
    if (qm > 85 && yn2 == 'Y')
    {
    jxj = jxj + 1000;
    }
    if (bj > 80 && yn1 == 'Y')
    {
    jxj = jxj + 850;
    }
    total = total + jxj;
    if (jxj > max)
    {
    max = jxj;
    strcpy(Name, name);
    }

    }
    cout << Name << endl;
    cout << max << endl;
    cout<< total << endl;
    return 0;
    }

  • 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.

信息

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