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 1AC

Posted by aiouniya at 2012-08-29 16:02:33 on Problem 2579
var i,j,r,c:integer;
    ave:real;
    a:array[0..100,0..100]of integer;
    s:string;
begin
  readln(s);
  while s<>'ENDOFINPUT' do begin
    if s<>'END' then begin
    fillchar(a,sizeof(a),0);
    r:=ord(s[7])-48;
    c:=ord(s[9])-48;
    for i:=1 to r do begin
      readln(s);
      for j:=1 to c do
        a[i,j]:=ord(s[j])-48;
        end;
    for i:=2 to r do begin
      for j:=2 to c do begin
        ave:=(a[i,j]+a[i-1,j]+a[i,j-1]+a[i-1,j-1])/4;
        write(trunc(ave));
      end;
      writeln;
      end;
    end;
    readln(s);
  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