Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- program w17;
- {$APPTYPE CONSOLE}
- uses
- SysUtils;
- var
- a,b: array[1..35000] of integer;
- i,min,max,j,n,t: integer;
- eq: boolean;
- begin
- { TODO -oUser -cConsole Main : Insert code here }
- min:=35000;
- max:=0;
- reset(input,'input.txt');
- rewrite(output,'output.txt');
- read(n);
- dec(n);
- for i:=1 to 35000 do
- b[i]:=0;
- for i:=1 to n do
- begin
- read(a[i]);
- inc(b[a[i]]);
- if a[i]>max then
- max:=a[i];
- end;
- for i:=1 to max do
- if (b[i]<min)and(b[i]<>0) then
- min:=b[i];
- if min=n then
- write(output,'1')
- else
- for i:=min downto 1 do
- begin
- if (min mod i = 0)and(n mod i = 0) then
- for t:=1 to i-1 do
- begin
- eq:=true;
- for j:=1 to (n div i) do
- if a[j]<>a[t*((n div i)+j)] then
- eq:=false;
- end;
- if i=1 then
- begin
- write(output,n);
- break;
- end
- else
- if eq=true then
- begin
- write(output,(n div i));
- break;
- end;
- end;
- end.
Add Comment
Please, Sign In to add comment