PersonalCorpus 版 (精华区)
151936 13:15:29 2 Mar 2002
Bozhang,HIT,P.R.China 1194 Pascal Accepted 0.06 sec 135K
var
s:array[1..100000] of word;
n,k,a,b,c,d,i,j:word;
tot:comp;
begin
readln(n,k); tot:=0; s[1]:=n;
while not eof(input) do begin
read(a,b);
j:=s[a];
for i:=1 to b do begin
read(c,d);
s[c]:=d;
tot:=tot+d*(j-d);
j:=j-d;
end;
if not eof(input) then readln;
end;
writeln(tot:0:0);
end.
Powered by KBS BBS 2.0 (http://dev.kcn.cn)
页面执行时间:2.952毫秒