主题:大家讨论一下,2007的复赛题!!!!!!!
sky风吻
[专家分:30] 发布于 2007-11-03 15:31:00
http://www.jxgzedu.gov.cn/fgwadmin001/edit/UploadFile/20071024113455445.doc
回复列表 (共9个回复)
沙发
shisutianxia [专家分:630] 发布于 2007-11-03 15:38:00
你也是赣州的?你考的很好吧!你是不是那位会用C,PASCAL的?(我同学跟我讲的)
帮我看看吧!滑雪。。。
program makeit;
type typed=record
x,y:integer;
end;
var lh:array[1..70,1..70]of integer;
rec,kw,i,j,m,n:integer;
procedure find(x,y:integer;k:integer);
var i,j:integer;xy:array[1..4] of typed;
begin
i:=0;
if (x-1>0)and(lh[x-1,j]<k) then begin inc(i);xy[i].x:=x-1;xy[i].y:=y;end;
if (y-1>0)and(lh[x,y-1]<k) then begin inc(i);xy[i].x:=x;xy[i].y:=y-1;end;
if (y+1<=m)and(lh[x,y+1]<k)then begin inc(i);xy[i].x:=x;xy[i].y:=y+1;end;
if (x+1<=n)and(lh[x+1,y]<k)then begin inc(i);xy[i].x:=x+1;xy[i].y:=y;end;
for j:=1 to i do
begin
kw:=kw+1;
if kw=n*m then begin writeln(kw);halt;end;
if kw>rec then rec:=kw;
find(xy[j].x,xy[j].y,lh[xy[j].x,xy[j].y]);
end;
kw:=kw-1;
end;
begin
readln(m,n);
for i:=1 to m do
begin
for j:=1 to n do
read(lh[j,i]);
readln;
end;
for i:=1 to m do
for j:=1 to n do
begin
kw:=0;
find(j,i,lh[j,i]);
end;
writeln('tot=',kw);
end.
3 楼
shisutianxia [专家分:630] 发布于 2007-11-03 17:04:00
不好意思,原来程序有点问题(你帮我看看,我马上就搞出来)
program qiujie;
var a:array[1..50]of integer;rec:array[1..1000]of integer;
o,b,i,j,r,n,m,k,t:integer;
function fac(a:integer):integer;
var p,i:integer;
begin
p:=1;
for i:=1 to a do
p:=p*m;
fac:=p;
end;
procedure jie;
var s,p:integer;
begin
s:=0;
for p:=1 to b do
begin s:=s+fac(a[p]);end;
inc(t);rec[t]:=s+fac(j);
end;
procedure dg(st,q:integer);
var b:integer;
begin
if q=0 then jie
else for b:=st to n-q+1 do begin
i:=i+1;a[i]:=b;dg(b+1,q-1);
end;
i:=i-1;
end;
begin
fillchar(a,sizeof(a),0);
fillchar(rec,sizeof(rec),0);
readln(m,k);
rec[1]:=1;t:=1;j:=1;
repeat
inc(t);rec[t]:=fac(j);
n:=j-1;
for b:=1 to j do
dg(0,b);
inc(j);
until t>=k;
writeln('==',rec[k]);
end.
4 楼
shisutianxia [专家分:630] 发布于 2007-11-03 17:15:00
答案出来了,排列的时候 I 没有初始化(我们真的要细心点呀!!哎)
program qiujie;
var a:array[1..50]of integer;rec:array[1..1000]of integer;
o,b,i,j,r,n,m,k,t:integer;
function fac(a:integer):integer;
var p,i:integer;
begin
p:=1;
for i:=1 to a do
p:=p*m;
fac:=p;
end;
procedure jie;
var s,p:integer;
begin
s:=0;
for p:=1 to b do
begin s:=s+fac(a[p]);end;
inc(t);rec[t]:=s+fac(j);writeln(rec[t]);
end;
procedure dg(st,q:integer);
var b:integer;
begin
if q=0 then jie
else for b:=st to n-q+1 do begin
i:=i+1;a[i]:=b;dg(b+1,q-1);
end;
i:=i-1;
end;
begin
fillchar(a,sizeof(a),0);
fillchar(rec,sizeof(rec),0);
readln(m,k);
rec[1]:=1;t:=1;j:=1;
repeat
inc(t);rec[t]:=fac(j);writeln(rec[t]);
n:=j-1;
for b:=1 to j do
begin
i:=0;
dg(0,b);
end;
inc(j);
until t>=k;
writeln('==',rec[k]);
end.
5 楼
shisutianxia [专家分:630] 发布于 2007-11-03 17:17:00
问一下,你有进入复赛没???我的命运很悲惨的,不知道进了没有
6 楼
shisutianxia [专家分:630] 发布于 2007-11-03 17:28:00
不好意思,最后一题可能没时间看了(我在学校上课),考的时候我没看那题,有规律的(可以用二叉树分析),尽力,我看看,把规律找出来
7 楼
shisutianxia [专家分:630] 发布于 2007-11-03 17:37:00
出来了,三个点用三条,在加点的话,加一点多一条
程序
PROGRAM JIAQIAO;
VAR N:INTEGER;
BEGIN
READLN(N);
IF N=1 THEN WRITE(1)ELSE IF N<=3 THEN WRITE(N);
IF N>3 then write(3+(n-3)*2);
end.
8 楼
dlyjr316 [专家分:0] 发布于 2007-11-09 19:59:00
有无标程??有无测诫数据???
9 楼
fenglixing [专家分:0] 发布于 2007-11-09 21:32:00
不知哪位高手能帮给我一些复赛复习的资料呢?
我现在很需要啊!
QQ:398293098(用QQ发也可以)
我来回复