请大家看看我写的这个程序为什么错误,拜托
pascal吧
全部回复
仅看楼主
level 3
var n,m,i,j,k,o:longint;
a:array['a'..'z']of longint;
b,s,f,h:array[0..21]of longint;
c,t:array[0..20]of string;
begin
readln(n,m);
for i:=1 to n do read(a[chr(i+96)]);
for i:=1 to m do read(b[i],c[i],t[i]);
for i:=1 to m do
begin
k:=pos(':',c[i]);
val(copy(t[i],1,k-1),s[i]);
val(copy(t[i],k+1,length(t[i])-k),f[i]);
end;
s[m+1]:=25;
for i:=1 to m do
begin
for j:=1 to length(c) do
begin
f[i]:=f[i]+a[c[i[j]]];
h[i]:=h[i]+a[c[i[j]]];
if f[i]>=60 then
begin
inc(s[i]);
f[i]:=f[i]-60;
end;
if s[i]>=24 then s[i]:=s[i]-24;
end;
if (s[i+1]<s[i])or(s[i+1]=s[i])and(f[i+1]<f[i]) then
begin
o:=0;
if f[i+1]>f[i] then o:=60;
f[i+1]:=f[i+1]+h[i]-f[i+1]+f[i]+o;
if f[i+1]>=60 then
begin
inc(s[i+1]);
f[i+1]:=f[i+1]-60;
end;
if s[i]>=24 then s[i]:=s[i]-24;
end;
end;
for i:=1 to m do
writeln(b[i],' ',s[i],':',f[i]);
end.
2017年01月01日 13点01分 1
level 3
[疑问]说有错误,自己找不出来
2017年01月02日 01点01分 2
level 1
f[i]:=f[i]+a[c[i[j]]];
h[i]:=h[i]+a[c[i[j]]];
这两句有问题?
2017年01月07日 02点01分 6
f的定义呢?
2017年01月07日 02点01分
1