9 procedure check(expr: boolean; msg: string);
\r
11 if (not expr) then begin
\r
12 writeln(erroutput, 'Error: ', msg);
\r
18 n, i, ii, u, v: int;
\r
19 p: array [1..100] of char;
\r
22 reset(input, 'headshot.in');
\r
23 rewrite(output, 'headshot.out');
\r
26 while (not seekeoln) do begin
\r
28 check(n <= 100, 'n is greater than 100');
\r
30 check((p[n] = '0') or (p[n] = '1'), 'some of chambers != 0 and != 1');
\r
35 for i := 1 to n do begin
\r
36 ii := (i mod n) + 1;
\r
37 if (p[i] = '0') then begin
\r
38 if (p[ii] = '0') then
\r
45 if (u * n = v * v) then
\r
47 else if (u * n > v * v) then
\r