aboutsummaryrefslogtreecommitdiff
path: root/challenge-134/abigail/pascal/ch-2.p
blob: b255ae62d601da8b037aea68ab50d9b862695f92 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
Program XXX;

(*                  *)
(* See ../README.md *)
(*                  *)

(*                                                        *)
(* Run as: fpc -och-2.out ch-2.p; ./ch-2.out < input-file *)
(*                                                        *)

var
    n, m, i, j, count: integer;
    seen: array of integer;

begin
    while (not eof) do begin
        readln (n, m);
        setLength (seen, n * m);
        for i := 1 to n * m do begin
            seen [i] := 0;
        end;
        count := 0;
        for i := 1 to n do begin
            for j := 1 to m do begin
                if seen [i * j] = 0
                then begin
                    count := count + 1;
                    seen [i * j] := 1;
                end
            end
        end;
        writeln (count);
    end
end.