Code Pastie ID: 5134 (Edit or View CSS/HTML)

Passcode:    


(* § Problem 1: The Triangle *)

(* Tom Verhoeff, Eindhoven University of Technology *)
(* Inefficient recursive solution *)

(* Translated from Turbo Pascal to Component Pascal *)
(* By Helmut Zinn -  *)

  CONST
    Test = Debug.Test;
    MaxN = 100;

  VAR
    fm: TextMappers.Formatter;
    N: INTEGER; (* number of rows 1..MaxN *)
    T: ARRAY MaxN+1, MaxN+1 OF INTEGER;
    (* T[r, p] is the number in row r at position p *)
    m: INTEGER; (* maximum route sum *)

  PROCEDURE Init;
  BEGIN
    In.Open('Input.txt');
    Out.Open(fm);
    IF Test THEN 
      fm.WriteString('IOI' + '94 - Day 1 - Problem 1: The Triangle');
      fm.WriteLn 
    END
  END Init;

END test123;