program Program3; var m, n : integer; mark : Boolean; function test(m, N : integer) : integer; var i, p : integer; flag : boolean; begin m := m - 1; i := 0; flag := False; for p:= 2 * N downto (N + 1) do begin i := (i + m) mod p; if (i begin test := 0; flag := Ture; Break; end end; if not(flag) then test:=1; end; begin read(n); m := 1; Mark := False; repeat if (test(m, n) = 1) then begin writeln(m); break; end; m := m + 1; until Mrak; end.输入:7
输出:1