Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

PASCAL的各位 加油,这里发代码给你们借鉴下

Posted by q1249380768 at 2011-01-27 16:44:30
做了1个半小时,时间原来过得这么快......
var m,n,i,j,flag,f,x,y:integer;
a:array [1..100,1..100] of char;
c:char;
bj:boolean;
procedure c_1;
var p:integer;
begin
  if c='Z' then c:='A'
           else
  begin
    p:=ord(c);
    inc(p);
    c:=chr(p);
  end;
end;
procedure pd;
var s,d:integer;
begin
  bj:=true;
  for s:=1 to m do
  for d:=1 to n do
  if a[s,d]=#0 then begin bj:=false;break;end;
end;
begin
  bj:=false;
  readln(m,n);
  flag:=0;
  f:=1;
  fillchar(a,sizeof(a),0);
  c:='A';
  i:=m-1;j:=n;flag:=0;
  x:=1;y:=1;
  repeat
    inc(flag);
    case flag of
    1:begin
        for y:=f to n-f+1 do
        begin
          a[f,y]:=c;
          c_1;
        end;
      end;
    2:begin
        for x:=f+1 to m-f+1 do
        begin
          a[x,n-f+1]:=c;
          c_1;
        end;
      end;
    3:begin
        for y:=n-f downto f do
        begin
          a[m-f+1,y]:=c;
          c_1;
        end;
      end;
    4:begin
        for x:=m-f downto f+1 do
        begin
          a[x,f]:=c;
          c_1;
        end;
        inc(f);
      end;
    end;{case}
    pd;
  until bj;
  for i:=1 to m do
  for j:=1 to n do
  begin
    write(a[i,j]:4);
    if j=n then writeln;
  end;
end.

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator