level 6
soso9spikear
楼主
program p1027;const maxn=10000;var a:array[1..2*maxn] of integer; t,i,n:integer; procedure wash; var s:array[1..2*maxn] of integer; j:integer; begin for j:=1 to n do begin s[2*j-1]:=a[n+j]; s[2*j]:=a[j]; end; for j:=1 to 2*n do a[j]:=s[j]; end; function check:boolean; var j:integer; ok:boolean; begin ok:=true; for j:=1 to 2*n do if a[j]<>j then begin ok:=false; break; end; check:=ok; end;begin repeat readln(n); for i:=1 to 2*n do a[i]:=i; t:=0; repeat wash; inc(t); until check; writeln(t); until seekeof;end.
2006年05月21日 09点05分
1