比赛 NOIP模拟赛by mzx Day2 评测结果 C
题目名称 森林大礼包 最终得分 0
用户昵称 燕哥到此一游 运行时间 0.000 s
代码语言 Pascal 内存使用 0.00 MiB
提交时间 2016-10-20 21:55:20
显示代码纯文本
program fuckyouquadruple;
var
  fin,fout:text;
  n,k,ans,i,j:longint;
  a:array[1..100000] of 1..10;
  b:array[1..100000,1..10] of longint;
function work(x:longint):longint;
  var
    i:longint;
  begin
    work:=0;
    if x=0
    then work:=1
    else
      for i:=1 to a[x] do
        work:=(work+(work(b[x,i]) mod 1000000007)) mod 1000000007;
  end;
begin
  assign(fin,'three_squirrels.in');
  assign(fout,'three_squirrels.out');
  reset(fin);
  rewrite(fout);
  readln(fin,n);
  ans:=0;
  for i:=1 to n do
    begin
      read(fin,a[i]);
      for j:=1 to a[i] do
        read(fin,b[i,j]);
    end;
  ans:=work(n);
  writeln(fout,ans);
  close(fin);
  close(fout);
end.