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

报告:judge把我程序的数组越界判成wa了~(郁闷了我半天……)

Posted by wangchen1ren at 2004-12-28 22:34:16 on Problem 2000
Source:

program p2000;
var v:array[0..10000]of longint;
    n:longint;

procedure init;
  var i,j,k:longint;
begin
  fillchar(v,sizeof(v),0);
  k:=1;i:=1;v[0]:=0;
  while i<=10000 do begin
    for j:=1 to k do begin
      v[i]:=v[i-1]+k;      //这里的v[i]越界
      inc(i);
    end;
    inc(k);
  end;
end;

begin
//  assign(input,'input.txt');reset(input);
//  assign(output,'output.txt');rewrite(output);
  init;
  readln(n);
  while n<>0 do begin
    writeln(n,' ',v[n]);
    readln(n);
  end;
//  close(input);close(output);
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