|
123232332
|
var i,j,k,n,m:longint;
f:array[0..30,0..30]of longint;
begin
readln(n,m);
fillchar(f,sizeof(f),0);
f[1,0]:=1;
for k:=1 to m do
begin
f[1,k]:=f[2,k-1]+f[n,k-1];
for i:=2 to n-1 do
f[i,k]:=f[i-1,k-1]+f[i+1,k-1];
f[n,k]:=f[n-1,k-1]+f[1,k-1];
end;
write(f[1,m]);
close(input);
close(output);
end.
( 2015/6/8 12:54:41 ) |
1 |
var k,l,d,h,y,x,z,t,p,i,j,temp:longint;n,m:0..200;
a,b,a1,b1:array [0..201] of longint;
function min(q,w:longint):longint;
begin
if q>w then exit(w) else exit(q);
end;
begin
read(n,m,k,l,d);
for i:=1 to d do
begin
read(h,x,y,z);
if h=y then begin a[min(x,z)]:=a[min(x,z)]+1;a1[min(x,z)]:=min(x,z);end;
if x=z then begin b[min(h,y)]:=b[min(h,y)]+1;b1[min(h,y)]:=min(h,y);end;
end;
for i:=1 to m do
for j:=i+1 to m do
if a[i]<a[j] then
begin
temp:=a[i];a[i]:=a[j];a[j]:=temp;
temp:=a1[i];a1[i]:=a1[j];a1[j]:=temp;
end;
for i:=1 to l do
for j:=i+1 to l do
if a1[i]>a1[j] then
begin
temp:=a[j];a[j]:=a[i];a[i]:=temp;
temp:=a1[i];a1[i]:=a1[j];a1[j]:=temp;
end;
for i:=1 to n do
for j:=i+1 to n do
if b[i]<b[j] then
begin
temp:=b[j];b[j]:=b[i];b[i]:=temp;
temp:=b1[i];b1[i]:=b1[j];b1[j]:=temp;
end;
for i:=1 to k do
for j:=i+1 to k do
if b1[i]>b1[j] then
begin
temp:=b[i];b[i]:=b[j];b[j]:=temp;
temp:=b1[i];b1[i]:=b1[j];b1[j]:=temp;
end;
for i:=1 to k-1 do
write(b1[i],' ');
writeln(b1[k]);
for i:=1 to l-1 do
write(a1[i],' ');
writeln(a1[l]);
close(input);
close(output);
end.
( ) |
|