⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 chore.pas

📁 PASCAL光盘资料PASCAL光盘资料PASCAL光盘资料
💻 PAS
字号:
program chores;

const
  inputfile='chore.in';
  outputfile='chore.out';
  MaxN=10000;

var
  f1,f2:text;
  f:array[1..MaxN]of longint;
  N:integer;
  last:longint;

procedure init;
begin
   assign(f1,inputfile);
   reset(f1);
   assign(f2,outputfile);
   rewrite(f2);
end;

procedure solve;
var i,id,list:integer;
    max:longint;
    long:byte;
begin
  readln(f1,N);
  fillchar(f,sizeof(f),0);
  last:=0;
  for i:=1 to N do
    begin
      read(f1,id);read(f1,long);
      max:=0;
      read(f1,list);
      while list <>0 do
        begin
          if f[list]>max then max:=f[list];
          read(f1,list);
        end;
      f[i]:=max+long;
      if f[i]>last then last:=f[i];
    end;
end;

procedure out;
begin
  close(f1);
  writeln(f2,last);
  close(f2);
end;

begin
  init;
  solve;
  out;
end.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -