题目: |
program Programg3;
var m,n:integer; Mark :boo1ean;
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<N ) then
begin
test := 0; flag := True; 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 Mark;
end.
输入:7 输出:1872
|