Pagini recente » Cod sursa (job #1407191) | Cod sursa (job #1974998) | Cod sursa (job #1905338) | Cod sursa (job #548954) | Cod sursa (job #1819046)
Var
n : longint ;
a,x : array[0..500000] of longint ;
Procedure Enter ;
var i,j : longint ;
begin
read(n) ;
for i := 1 to n do read(x[i]) ;
end ;
Procedure Main ;
var i,j,cnt,len : longint ; ok : boolean ;
begin
cnt := 0 ;
for i := 2 to n do a[i-1] := x[i] - x[i-1] ;
for len := 1 to n-1 do
begin
ok := false ;
for i := len+1 to n-1 do
if ((i mod len <> 0) and (a[i mod len] <> a[i])) or ((i mod len = 0) and (a[len] <> a[i])) then begin ok := true ; break ; end ;
if (ok) then continue ;
writeln(len) ;
for i := 1 to len do writeln(a[i]) ;
exit ;
end ;
end ;
Begin
ASSIGN(input,'reguli.in') ; reset(input) ;
ASSIGN(output,'reguli.out') ; rewrite(output) ;
enter ;
Main ;
CLOSE(input) ; CLOSE(output) ;
End.