aboutsummaryrefslogtreecommitdiff
path: root/challenge-252/deadmarshal/pascal/ch1.pas
blob: a30264ab54d958c183846090110f83c917c6fcd8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
program Ch1;

{$mode objfpc}
uses
  SysUtils,Types;
    
var 
  A1,A2:TIntegerDynArray;
  
function SpecialNumbers(VAR A:TIntegerDynArray):Integer;
var I:Integer;
begin
  Result := 0;
  for I := Low(A) TO High(A) do 
    if Length(A) mod (I+1) = 0 then Inc(Result,A[I]*A[I]);
end;

begin
  A1 := [1,2,3,4];
  A2 := [2,7,1,19,18,3];
  Writeln(SpecialNumbers(A1));
  Writeln(SpecialNumbers(A2));
end.