vijos 1001 pascal
答案:3 悬赏:40 手机版
解决时间 2021-06-07 09:30
- 提问者网友:暮烟疏雨之际
- 2021-06-06 09:13
money就是每个人的奖学金,wz是文章数量,qimo就是期末成绩,class是班级评议成绩
样例数据对了,我去提交只有30分
program p1001;
var n:longint;
name:array[1..100] of string;
money,wz,qimo,class:array[1..100] of longint;
west,gb:array[1..100] of char;
procedure inp;
var i,j:longint;
temp,k:string;
begin
readln(n);
for i:=1 to n do
begin
readln(temp);
while temp[1]<>' ' do
begin
name[i]:=name[i]+copy(temp,1,1);
delete(temp,1,1);
end;
delete(temp,1,1);
k:='';
while temp[1]<>' ' do
begin
k:=k+copy(temp,1,1);
delete(temp,1,1);
end;
val(k,qimo[i]);
k:='';
delete(temp,1,1);
while temp[1]<>' ' do
begin
k:=k+copy(temp,1,1);
delete(temp,1,1);
end;
val(k,class[i]);
k:='';
delete(temp,1,1);
gb[i]:=temp[1];
delete(temp,1,2);
west[i]:=temp[1];
delete(temp,1,2);
j:=0;
while (temp[1]<>' ') or (temp<>'') do
begin
k:=k+copy(temp,1,1);
delete(temp,1,1);
j:=j+1;
if j>2 then break;
end;
val(k,wz[i]);
end;
end;
procedure work;
var i,max,j:longint;
maxn:string;
begin
max:=0; maxn:=''; j:=0;
for i:=1 to n do
begin
if (wz[i]>=1) and (qimo[i]>80) then money[i]:=money[i]+8000;
if (qimo[i]>85) and (class[i]>80) then money[i]:=money[i]+4000;
if (qimo[i]>90) then money[i]:=money[i]+2000;
if (qimo[i]>85) and (west[i]='Y') then money[i]:=money[i]+1000;
if (qimo[i]>80) and (gb[i]='Y') then money[i]:=money[i]+850;
if money[i]>max then begin max:=money[i]; maxn:=name[i]; end;
end;
writeln(maxn);
writeln(max);
for i:=1 to n do j:=j+money[i];
writeln(j);
end;
begin
inp;
work;
end.
最佳答案
- 五星知识达人网友:末日狂欢
- 2021-06-06 10:35
var
a,name:string;
comd:integer;
n,i,qm,bj,lw:longint;
gb,xb:char;
he:longint;
s,max:longint;
st:string;
j:longint;
begin
readln(n); he:=0;
for i:=1 to n do
begin
readln(st);
j:=pos(' ',st);
a:=copy(st,1,j-1); delete(st,1,j);
j:=pos(' ',st);
val(copy(st,1,j-1),qm,comd); delete(st,1,j);
j:=pos(' ',st);
val(copy(st,1,j-1),bj,comd); delete(st,1,j);
gb:=st[1];
xb:=st[3];
delete(st,1,4);
val(st,lw,comd);
s:=0;
if (qm>80) and (lw>=1) then s:=s+8000;
if (qm>85) and (bj>80) then s:=s+4000;
if qm>90 then s:=s+2000;
if (qm>85) and (xb='Y') then s:=s+1000;
if (bj>80) and (gb='Y') then s:=s+850;
he:=he+s;
if (s>max) or (i=1) then begin max:=s; name:=a; end;
end;
writeln(name);
writeln(max);
writeln(he);
end.
全部回答
我的
已经AC
program scholar;
const
fin='scholar.in';
fout='scholar.out';
var
m,n,i,j,k,t,sum,p,max,q:longint;
code:integer;
st:string;
s:array[0..101] of string;
name:array[0..101] of string;
a:array[0..101,0..6] of longint;
begin
readln(n);
m:=0;
q:=1;
for i:=1 to n do
begin
readln(s[i]);
for j:=1 to length(s[i]) do
if s[i,j]=' ' then break;
name[i]:=copy(s[i],1,j-1);
delete(s[i],1,j);
for j:=1 to length(s[i]) do
if s[i,j]=' ' then break;
st:=copy(s[i],1,j-1);
val(st,a[i,1],code);
delete(s[i],1,j);
for j:=1 to length(s[i]) do
if s[i,j]=' ' then break;
st:=copy(s[i],1,j-1);
val(st,a[i,2],code);
delete(s[i],1,j);
for j:=1 to length(s[i]) do
if s[i,j]=' ' then break;
st:=copy(s[i],1,j-1);
if st='Y' then a[i,3]:=1 else a[i,3]:=0;
delete(s[i],1,j);
for j:=1 to length(s[i]) do
if s[i,j]=' ' then break;
st:=copy(s[i],1,j-1);
if st='Y' then a[i,4]:=1 else a[i,4]:=0;
delete(s[i],1,j);
j:=length(s[i]);
st:=copy(s[i],1,j);
val(st,a[i,5],code);
delete(s[i],1,j);
if (a[i,1]>80) and (a[i,5]>0) then a[i,6]:=a[i,6]+8000;
if (a[i,1]>85) and (a[i,2]>80) then a[i,6]:=a[i,6]+4000;
if (a[i,1]>90) then a[i,6]:=a[i,6]+2000;
if (a[i,1]>85) and (a[i,4]=1) then a[i,6]:=a[i,6]+1000;
if (a[i,2]>80) and (a[i,3]=1) then a[i,6]:=a[i,6]+850;
m:=m+a[i,6];sum:=sum+m;
if m>max then
begin
max:=m;
q:=i;
end;m:=0;
end;
writeln(name[q]);
writeln(max);
writeln(sum);
end.
- 2楼网友:第四晚心情
- 2021-06-06 10:47
aouvdbiqyrxlz你以上的一个语法错误,你自己观察。
我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯