522 条题解

  • 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;
    }

  • 0
    @ 2014-12-27 08:54:48

    o,shit

    不小心把班级贡献奖拿期末成绩去评了没注意,结果得了30分。害我浪费10分钟去找,总算轻松AC啦(AC不了就在VJ混不起了)
    看来以后比赛的时候复制粘贴还是要谨慎啊~~

    希望到时候别死在这里。还好我机智给测出来了。

    代码如下,纯读入输出而已。
    ###Block code
    program P1001;
    var n,i,k,s,max:longint;
    sum:int64;
    a:string;
    add:char;
    namee:array[1..100] of string;
    num:array[1..100,1..4] of longint;
    pd:array[1..100,1..2] of char;
    procedure readname;
    begin
    for i:=1 to n do
    begin
    add:='a'; a:='';
    read(add);
    while add<>' ' do
    begin
    a:=a+add;
    read(add);
    end;
    namee[i]:=a;
    s:=length(a);

    read(num[i,1]);
    read(num[i,2]);

    read(add);
    read(add);
    pd[i,1]:=add;
    read(add); read(add);
    pd[i,2]:=add;
    read(num[i,3]);
    end;
    end;

    begin //main
    read(n); a:=''; sum:=0; max:=1;
    fillchar(num,sizeof(num),0);
    readname;

    for i:=1 to n do
    begin
    if (num[i,1]>80) and (num[i,3]>=1) then
    begin
    num[i,4]:=num[i,4]+8000;
    sum:=sum+8000;
    end;

    if (num[i,1]>85) and (num[i,2]>80) then
    begin
    num[i,4]:=num[i,4]+4000;
    sum:=sum+4000;
    end;

    if (num[i,1]>90) then
    begin
    num[i,4]:=num[i,4]+2000;
    sum:=sum+2000;
    end;

    if (num[i,1]>85) and (pd[i,2]='Y') then
    begin
    num[i,4]:=num[i,4]+1000;
    sum:=sum+1000;
    end;

    if (num[i,2]>80) and (pd[i,1]='Y') then
    begin
    num[i,4]:=num[i,4]+850;
    sum:=sum+850;
    end;

    if num[i,4]>num[max,4] then
    max:=i;
    end;

    writeln(namee[max]);
    writeln(num[max,4]);
    write(sum);
    end.

    • @ 2014-12-30 11:12:27

      我可以说我和你犯了一样的错吗。。。结果我是这个纠结加郁闷啊。。。
      看到你说你得了30分猛然发现我也是。。。。

    • @ 2015-01-11 07:52:09

      @wlxsq 呵呵

  • 0
    @ 2014-12-13 22:40:19

    用case做了
    var s,s1,anss:string;
    i,j,k,p,n,ans,qi,ba,ga,xi,lu,zui:longint;
    procedure work;
    var xy:longint;
    begin
    xy:=0;
    if (lu>=1) and (qi>80) then xy:=xy+8000;
    if (qi>85) and (ba>80) then xy:=xy+4000;
    if (qi>90) then xy:=xy+2000;
    if (qi>85) and (xi=1) then xy:=xy+1000;
    if (ba>80) and (ga=1) then xy:=xy+850;
    if xy>zui then begin
    anss:=s1;
    zui:=xy;
    end;
    ans:=ans+xy;
    end;
    begin
    readln(n);
    for i:=1 to n do begin
    readln(s);
    s:=s+' ';
    qi:=0;ba:=0;ga:=0;xi:=0;lu:=0;
    k:=0;
    for j:=1 to length(s) do begin
    if s[j]=' ' then begin
    k:=k+1;
    case k of
    1:begin
    s1:=copy(s,1,j-1);
    p:=j;
    end;
    2:begin
    val(copy(s,p+1,j-p-1),qi);
    p:=j;
    end;
    3:begin
    val(copy(s,p+1,j-p-1),ba);
    p:=j
    end;
    4:if s[j-1]='Y' then ga:=1;
    5:begin
    if s[j-1]='Y' then xi:=1;
    p:=j;
    end;
    6:val(copy(s,p+1,j-p-1),lu);
    end;
    end;

    end;
    work;
    end;
    writeln(anss);
    writeln(zui);
    writeln(ans);
    end.

  • 0
    @ 2014-12-05 14:29:47

    题解:总算过了。
    #include <iostream>
    #include <string>
    using namespace std;
    struct Stu{
    char name[20];
    int score1;
    int score2;
    char leader;
    char westStudent;
    int article;
    int sum=0;
    };
    int main(){

    int max=0;
    int rmb=0;
    int n;
    Stu a[100];
    cin>>n;
    for(int i=0;i<n;i++){
    cin>>a[i].name;
    cin>>a[i].score1;
    cin>>a[i].score2;
    cin>>a[i].leader;
    cin>>a[i].westStudent;
    cin>>a[i].article;
    }
    for(int j=0;j<n;j++){
    if(a[j].score1>80&&a[j].article>=1) a[j].sum+=8000;
    if(a[j].score1>85&&a[j].score2>80) a[j].sum+=4000;
    if(a[j].score1>90) a[j].sum+=2000;
    if(a[j].score1>85&&a[j].westStudent=='Y') a[j].sum+=1000;
    if(a[j].score2>80&&a[j].leader=='Y') a[j].sum+=850;
    rmb+=a[j].sum;
    }
    for(int p=0;p<n;p++){
    if(a[p].sum>a[max].sum)
    max=p;
    }
    cout<<a[max].name<<endl;
    cout<<a[max].sum<<endl;
    cout<<rmb<<endl;
    return 0;
    }

  • 0
    @ 2014-11-30 16:20:35

    type

    Tmingzi=array[1..21] of char;

    student=record

    mingzi:Tmingzi;

    lenmingzi:longint;

    qmcj:longint;

    bjcj:longint;

    gb:boolean;

    xb:boolean;

    lw:longint;

    jxj:longint;

    end;

    var

    temp1,temp2,h1,h2,h3:char;

    a:array[1..100] of student;

    i,n,j,max,sum:longint;

    procedure getjxj(var s:student);

    begin

    if (s.qmcj>80) and (s.lw>=1) then s.jxj:=s.jxj+8000;

    if (s.qmcj>85) and (s.bjcj>80) then s.jxj:=s.jxj+4000;

    if s.qmcj>90 then s.jxj:=s.jxj+2000;

    if (s.qmcj>85) and (s.xb) then s.jxj:=s.jxj+1000;

    if (s.bjcj>80) and (s.gb) then s.jxj:=s.jxj+850;

    end;

    begin

    readln(n);

    for i:=1 to n do

    begin

    for j:=1 to 21 do

    begin

    read(a[i].mingzi[j]);

    if a[i].mingzi[j]=' ' then

    begin

    a[i].lenmingzi:=j-1;

    break;

    end;

    end;

    readln(a[i].qmcj,a[i].bjcj,h1,temp1,h2,temp2,h3,a[i].lw);

    case temp1 of

    'Y':a[i].gb:=true;

    'N':a[i].gb:=false;

    end;

    case temp2 of

    'Y':a[i].xb:=true;

    'N':a[i].xb:=false;

    end;

    end;

    for i:=1 to n do

    getjxj(a[i]);

    max:=1;

    for i:=n downto 1 do

    if a[i].jxj>=a[max].jxj then max:=i;

    sum:=0;

    for i:=1 to n do

    sum:=sum+a[i].jxj;

    for i:=1 to a[max].lenmingzi do

    write(a[max].mingzi[i]);

    writeln;

    writeln(a[max].jxj);

    writeln(sum);

    end.

  • 0
    @ 2014-11-07 22:37:53

    可能比较笨。。。但是AC了

    #include<iostream>
    #include<algorithm>
    #include<cstdlib>
    using namespace std;
    typedef struct book{
    int num;
    char name[20];
    int endaver;
    int classaver;
    char emp;
    char west;
    int pass;
    int sum;};
    book que[101];
    int is_west(int a){
    return (que[a].west=='Y') ? 1:0;}
    int is_pass(int a){
    return (que[a].pass>0)?1:0;}
    int is_emp(int a){
    return (que[a].emp=='Y')? 1:0;}
    int prize(int a){
    if(que[a].classaver>80&&is_emp(a))
    que[a].sum+=850;
    if(que[a].endaver>90)
    que[a].sum+=2000;
    if(que[a].endaver>80&&is_pass(a))
    que[a].sum+=8000;
    if(que[a].endaver>85&&que[a].classaver>80)
    que[a].sum+=4000;
    if(que[a].endaver>85&&is_west(a))
    que[a].sum+=1000;}
    int main(){
    int n,summ=0;
    cin >>n;
    int max=0,maxi=0;
    for(int i=0;i<n;i++){
    scanf("%s %d %d %c %c %d",que[i].name,&que[i].endaver,&que[i].classaver,&que[i].emp,&que[i].west,&que[i].pass) ;
    que[i].num=i;
    prize(i);
    if(que[i].sum>max)
    {
    max=que[i].sum;
    maxi=i;
    }}
    for(int aaa=0;aaa<n;aaa++){
    summ+=que[aaa].sum;
    }
    printf("%s\n",que[maxi].name);
    printf("%d\n",max);
    printf("%d",summ);
    }

  • 0
    @ 2014-11-07 22:37:42

    可能比较笨。。。但是AC了

    #include<iostream>
    #include<algorithm>
    #include<cstdlib>
    using namespace std;
    typedef struct book{
    int num;
    char name[20];
    int endaver;
    int classaver;
    char emp;
    char west;
    int pass;
    int sum;};
    book que[101];
    int is_west(int a){
    return (que[a].west=='Y') ? 1:0;}
    int is_pass(int a){
    return (que[a].pass>0)?1:0;}
    int is_emp(int a){
    return (que[a].emp=='Y')? 1:0;}
    int prize(int a){
    if(que[a].classaver>80&&is_emp(a))
    que[a].sum+=850;
    if(que[a].endaver>90)
    que[a].sum+=2000;
    if(que[a].endaver>80&&is_pass(a))
    que[a].sum+=8000;
    if(que[a].endaver>85&&que[a].classaver>80)
    que[a].sum+=4000;
    if(que[a].endaver>85&&is_west(a))
    que[a].sum+=1000;}
    int main(){
    int n,summ=0;
    cin >>n;
    int max=0,maxi=0;
    for(int i=0;i<n;i++){
    scanf("%s %d %d %c %c %d",que[i].name,&que[i].endaver,&que[i].classaver,&que[i].emp,&que[i].west,&que[i].pass) ;
    que[i].num=i;
    prize(i);
    if(que[i].sum>max)
    {
    max=que[i].sum;
    maxi=i;
    }}
    for(int aaa=0;aaa<n;aaa++){
    summ+=que[aaa].sum;
    }
    printf("%s\n",que[maxi].name);
    printf("%d\n",max);
    printf("%d",summ);
    }

  • 0
    @ 2014-11-03 15:56:07

    #include<cstdio>
    #include<cstdlib>
    #include<cmath>
    #include<cstring>
    int n,a,b,c,k,ans[105],sum,max;
    char name[105][40],ju1,ju2,s[40];
    int main()
    {
    scanf("%d",&n);
    for(int i=1;i<=n;i++)
    {
    scanf("%s%d%d %c %c %d",name[i],&a,&b,&ju1,&ju2,&c);
    if(a>80&&c>=1) ans[i]+=8000;
    if(a>85&&b>80) ans[i]+=4000;
    if(a>90) ans[i]+=2000;
    if(a>85&&ju2=='Y') ans[i]+=1000;
    if(b>80&&ju1=='Y') ans[i]+=850;
    sum+=ans[i];
    if(ans[i]>max)
    {
    max=ans[i];
    k=i;
    }
    }
    printf("%s",name[k]);
    printf("\n%d\n%d\n",ans[k],sum);
    return 0;
    }

  • 0
    @ 2014-10-25 11:15:43

    #include<iostream>
    #include<algorithm>
    #include<queue>
    #include<string>
    #include<cstdio>
    #include<cstdlib>
    #include<cstring>
    #include<ctime>
    #include<cmath>
    #include<cctype>
    using namespace std;
    int N,alm=0,aln=0;
    struct student
    {
    int num;
    string name;
    int rmb;
    }stu[101];
    const bool stusort(const student &a,const student &b)
    {
    if(a.rmb!=b.rmb) return a.rmb>b.rmb;
    return a.num<b.num;
    }
    int main()
    {
    //freopen(".in","r",stdin);
    //freopen(".out","w",stdout);
    scanf("%d\n",&N);
    for(int i=1;i<=N;i++)
    {
    alm=0;
    int fnl=0,cnl=0,lw=0;
    char tmp1,tmp2;
    cin>>stu[i].name;
    scanf(" %d%d",&fnl,&cnl);
    scanf(" %c",&tmp1);
    scanf(" %c",&tmp2);
    scanf(" %d",&lw);
    if(fnl>80 && lw>=1)
    alm+=8000;
    if(fnl>85 && cnl>80)
    alm+=4000;
    if(fnl>90)
    alm+=2000;
    if(fnl>85 && tmp2=='Y')
    alm+=1000;
    if(cnl>80 && tmp1=='Y')
    alm+=850;
    aln+=alm;
    stu[i].rmb=alm;
    stu[i].num=i;
    }
    sort(stu+1,stu+N+1,stusort);
    cout<<stu[1].name<<endl;
    printf("%d\n%d\n",stu[1].rmb,aln);
    return 0;
    }
    此题弱爆,鉴定完毕

  • 0
    @ 2014-09-30 22:48:54

    #include <iostream>
    #include <math.h>
    using namespace std;
    int main()
    {
    long long money[102],n,i,j,mark[102],cmark[102],art[102],sum,max;
    int turn[102];
    string name[102],xue[102],xi[102],str;
    cin>>n;
    for (i=1;i<=n;i++)
    {
    cin>>name[i];
    cin>>mark[i];
    cin>>cmark[i];
    cin>>xue[i];
    cin>>xi[i];
    cin>>art[i];
    turn[i]=i;
    } //输入
    for (i=1;i<=n;i++) money[i]=0; //清零

    for (i=1;i<=n;i++)
    {
    if (mark[i]>80 && art[i]>=1) money[i]=money[i]+8000;
    if (mark[i]>85 && cmark[i]>80) money[i]=money[i]+4000;
    if (mark[i]>90) money[i]=money[i]+2000;
    if (mark[i]>85 && xi[i]=="Y") money[i]=money[i]+1000;
    if (xue[i]=="Y" && cmark[i]>80) money[i]=money[i]+850;
    } //计算每个人的奖学金
    sum=0;
    for (i=1;i<=n;i++) sum=sum+money[i];

    max=0;
    for (i=1;i<=n;i++)
    {
    if (max<money[i])
    {
    max=money[i];
    str=name[i];
    }
    }
    cout<<str<<endl;
    cout<<max<<endl;
    cout<<sum<<endl;
    system("pause");
    return 0;
    }

  • 0
    @ 2014-09-28 20:43:42

    请帮我看一下哪里错了(第二组数据在运算时错误),
    var i,q,n,k:longint;
    m,p,l,o:int64;
    a,s:string;
    lw,jj:array[1..100]of int64;
    mz:array[1..100]of string;
    g:array[1..100,1..2]of string;
    j:array[1..100,1..2]of int64;
    begin
    readln(n);
    for i:=1 to n do
    begin
    readln(a);
    for q:=1 to 6 do
    begin
    if q<>6 then begin k:=pos(' ',a);
    s:=copy(a,1,k-1) end else begin k:=1; s:=copy(a,1,k); val(s,lw[i]); end;
    val(s,j[i,q-1]);
    g[i,q-3]:=s;
    if q=1 then mz[i]:=copy(a,1,k-1);
    delete(a,1,k);
    end;
    if (j[i,1]>80)and(lw[i]>=1) then jj[i]:=jj[i]+8000;
    if (j[i,1]>85)and(j[i,2]>80) then jj[i]:=jj[i]+4000;
    if j[i,1]>90 then jj[i]:=jj[i]+2000;
    if (j[i,1]>85)and(g[i,2]='Y') then jj[i]:=jj[i]+1000;
    if (j[i,2]>80)and(g[i,1]='Y') then jj[i]:=jj[i]+850;
    if o<jj[i] then begin p:=i; o:=jj[i]; end;
    m:=m+jj[i];
    end;
    writeln(mz[p]);
    writeln(o);
    writeln(m);
    end.

  • 0
    @ 2014-08-23 13:32:23

    ###Block code
    #include <stdio.h>

    char stu[110][30];
    int n;
    int sch[110];

    int main() {
    int i, k, t;
    scanf("%d", &n);
    for (i = 0; i < n; i++) {
    scanf("%s %d %d %c %c %d", stu[i] + 5, &stu[i][0], &stu[i][1], &stu[i][2], &stu[i][3], &t);
    stu[i][4] = t + 1;
    }
    for (i = 0; i < n; i++) {
    if (stu[i][0] > 80 && stu[i][4] > 1) sch[i] += 8000;
    if (stu[i][0] > 85 && stu[i][1] > 80) sch[i] += 4000;
    if (stu[i][0] > 90) sch[i] += 2000;
    if (stu[i][0] > 85 && stu[i][3] == 'Y') sch[i] += 1000;
    if (stu[i][1] > 80 && stu[i][2] == 'Y') sch[i] += 850;
    }
    k = 0;
    for (i = 1; i < n; i++)
    if (sch[i] > sch[k])
    k = i;
    printf("%s\n%d\n", stu[k] + 5, sch[k]);
    for (i = 0, k = 0; i < n; i++)
    k += sch[i];
    printf("%d\n", k);
    return 0;
    }

  • 0
    @ 2014-08-18 18:07:20

    #include <iostream>
    #include <string>
    #ifdef DEBUG
    #include <fstream>
    #endif
    using namespace std;
    class Student
    {
    public:
    string name;
    int qm;
    int bj;
    string gb;
    string xb;
    int paper;
    int getScholar()
    {
    int sum = 0;

    if((qm > 80) && (paper > 0))
    sum += 8000;

    if((qm > 85) && (bj > 80))
    sum += 4000;

    if(qm > 90)
    sum += 2000;

    if((qm > 85) && (xb == "Y"))
    sum += 1000;

    if((bj > 80) && (gb == "Y"))
    sum += 850;

    return sum;
    }
    };
    int main()
    {
    #ifdef DEBUG
    #define INPUT input
    ifstream input;
    input.open("data.txt");
    #else
    #define INPUT cin
    #endif
    int N;
    INPUT >> N;
    Student* t = new Student[N];
    int Mmoney(0), Smoney(0);
    string Mname;

    for(int i = 0; i < N; i++)
    {
    INPUT >> t[i].name >> t[i].qm >> t[i].bj >> t[i].gb >> t[i].xb >> t[i].paper;

    if(t[i].getScholar() > Mmoney)
    {
    Mmoney = t[i].getScholar();
    Mname = t[i].name;
    }

    Smoney += t[i].getScholar();
    }

    cout << Mname << endl;
    cout << Mmoney << endl;
    cout << Smoney << endl;
    delete [] t;
    #ifdef DEBUG
    input.close();
    #endif

    return 0;
    }

  • 0
    @ 2014-08-10 12:52:24

    ###Block bode
    type data=record
    names:string;
    qimo:0..100;
    pingyi:0..100;
    ganbu:boolean;
    xibu:boolean;
    lunwen:0..10;
    jiangxuejin:longint;
    end;

    var x:array[1..100] of data;
    i,n,pos,sum:longint;
    t:char;

    begin
    readln(n);
    for i:=1 to n do
    with x[i] do
    begin
    read(t);
    while t<>' ' do
    begin
    names:=names+t;
    read(t);
    end;
    read(qimo,pingyi);
    read(t);
    read(t);
    if t='Y' then
    ganbu:=true;
    read(t);
    read(t);
    if t='Y' then
    xibu:=true;
    readln(lunwen);
    if (qimo>80) and (lunwen>0) then
    inc(jiangxuejin,8000);
    if (qimo>85) and (pingyi>80) then
    inc(jiangxuejin,4000);
    if qimo>90 then
    inc(jiangxuejin,2000);
    if (qimo>85) and xibu then
    inc(jiangxuejin,1000);
    if (pingyi>80) and ganbu then
    inc(jiangxuejin,850);
    end;
    pos:=1;
    sum:=x[1].jiangxuejin;
    for i:=2 to n do
    with x[i] do
    begin
    if jiangxuejin>x[pos].jiangxuejin then
    pos:=i;
    inc(sum,jiangxuejin);
    end;
    writeln(x[pos].names);
    writeln(x[pos].jiangxuejin);
    writeln(sum);
    end.

  • 0
    @ 2014-08-10 12:50:52

    type data=record
    names:string;
    qimo:0..100;
    pingyi:0..100;
    ganbu:boolean;
    xibu:boolean;
    lunwen:0..10;
    jiangxuejin:longint;
    end;

    var x:array[1..100] of data;
    i,n,pos,sum:longint;
    t:char;

    begin
    readln(n);
    for i:=1 to n do
    with x[i] do
    begin
    read(t);
    while t<>' ' do
    begin
    names:=names+t;
    read(t);
    end;
    read(qimo,pingyi);
    read(t);
    read(t);
    if t='Y' then
    ganbu:=true;
    read(t);
    read(t);
    if t='Y' then
    xibu:=true;
    readln(lunwen);
    if (qimo>80) and (lunwen>0) then
    inc(jiangxuejin,8000);
    if (qimo>85) and (pingyi>80) then
    inc(jiangxuejin,4000);
    if qimo>90 then
    inc(jiangxuejin,2000);
    if (qimo>85) and xibu then
    inc(jiangxuejin,1000);
    if (pingyi>80) and ganbu then
    inc(jiangxuejin,850);
    end;
    pos:=1;
    sum:=x[1].jiangxuejin;
    for i:=2 to n do
    with x[i] do
    begin
    if jiangxuejin>x[pos].jiangxuejin then
    pos:=i;
    inc(sum,jiangxuejin);
    end;
    writeln(x[pos].names);
    writeln(x[pos].jiangxuejin);
    writeln(sum);
    end.

  • 0
    @ 2014-08-09 18:30:04

    C++ 无文件版本 AC
    a数组多余,是为了其他可能出现的情况而存在,可精简。

    #include <iostream>
    #include <algorithm>
    #include <string>
    using namespace std;
    const int maxn=101;
    typedef struct
    {
    string name;
    int score_exam,score_class;
    char sir,west;
    int essay;
    int scholar,num;
    }student;
    int main()
    {
    student a[maxn];
    int n,sum=0;
    cin>>n;
    string ans;
    int max=0;
    for(int i=1;i<=n;i++)
    {
    a[i].scholar=0; a[i].num=i;
    cin>>a[i].name>>a[i].score_exam>>a[i].score_class>>a[i].sir>>a[i].west>>a[i].essay;
    if(a[i].score_exam>80 && a[i].essay>=1) a[i].scholar+=8000;
    if(a[i].score_exam>85 && a[i].score_class>80) a[i].scholar+=4000;
    if(a[i].score_exam>90) a[i].scholar+=2000;
    if(a[i].score_exam>85 && a[i].west=='Y') a[i].scholar+=1000;
    if(a[i].score_class>80 && a[i].sir=='Y') a[i].scholar+=850;
    sum+=a[i].scholar;
    if(a[i].scholar>max)
    {
    ans=a[i].name;
    max=a[i].scholar;
    }
    }
    cout<<ans<<endl<<max<<endl<<sum;
    return 0;
    }

  • 0
    @ 2014-08-02 23:40:13

    3wa

    原因:

    细节问题

    主要是变量以及数组的初始化问题

    其中计算单个学生奖金的ans没有初始化

    字符数组更新之前未初始化,以至于cout>>s,后面还残留有之前的值

信息

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