比赛 NOIP2015普及组练习 评测结果 AAAAAAAAAA
题目名称 谁拿了最多奖学金 最终得分 100
用户昵称 Ten.X 运行时间 0.009 s
代码语言 Pascal 内存使用 0.15 MiB
提交时间 2015-11-04 10:55:13
显示代码纯文本
var s,name:array[1..100]of string;
job,west,wenzhang:array[1..100]of boolean;
money:array[1..100] of longint;
fenshu,ping:array[1..100]of integer;
i,j,n:integer;l:string;he:longint;max:integer;
  procedure deal(a:string);
       begin
       i:=pos(' ',a);
       name[j]:=copy(a,1,i-1);
       delete(a,1,i);
       i:=pos(' ',a);
       l:=copy(a,1,i-1);
       if length(l)=3  then fenshu[j]:=100 else
       fenshu[j]:=10*(ord(l[1])-48)+(ord(l[2])-48);delete(a,1,i);
       i:=pos(' ',a);l:=copy(a,1,i-1);
       if length(l)=3  then ping[j]:=100 else
       ping[j]:=10*(ord(l[1])-48)+(ord(l[2])-48);delete(a,1,i);
       i:=pos(' ',a);l:=copy(a,1,i-1);
       if l='Y' then job[j]:=true else job[j]:=false;delete(a,1,i);
       i:=pos(' ',a);l:=copy(a,1,i-1);
       if l='Y' then west[j]:=true else west[j]:=false;delete(a,1,i);

       if a<>'0' then wenzhang[j]:=true else wenzhang[j]:=false;
       end;
   procedure jisuan;
       begin
       if (fenshu[j]>80) and (wenzhang[j]) then money[j]:=money[j]+8000;
       if (fenshu[j]>85) and (ping[j]>80) then money[j]:=money[j]+4000;
       if (fenshu[j]>90) then money[j]:=money[j]+2000;
       if (fenshu[j]>85) and (west[j]) then money[j]:=money[j]+1000;
       if (ping[j]>80) and (job[j]) then money[j]:=money[j]+850;
       end;
      begin
	  assign(input,'scholar.in');
	  assign(output,'scholar.out');
	  reset(input);
	  rewrite(output);
     readln(n);fillchar(money,sizeof(money),0);
     for i:=1 to n do readln(s[i]);
     for j:=1 to n do begin deal(s[j]);jisuan;end;
    he:=0;max:=money[1]; for i:=1 to n do he:=he+money[i];
       for i:=2 to n do
       if money[i]>max then begin max:=money[i];j:=i;end;
       writeln(name[j]);writeln(max);write(he);
     close(input);
	 close(output);
     end.