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 cz_xuyixuan at 2015-06-17 19:29:20 on Problem 3982
type
  ansistring=string;
var
  x,y,z,i:longint;
  a:array[0..99] of ansistring;
function add(x,y:ansistring):ansistring;
var l,m:ansistring;
    j,a,b,c,i,s:longint;
begin
  a:=length(x);b:=length(y);j:=0;
  if a>b
  then for i:=1 to a-b do y:='0'+y
  else for i:=1 to b-a do x:='0'+x;
  c:=length(x);
  l:='';
  for i:=c downto 1 do
    begin
      s:=((ord(x[i])-48+ord(y[i])-48)+j) mod 10;
      j:=((ord(x[i])-48+ord(y[i])-48)+j) div 10;
      l:=chr(s+48)+l;
    end;
  if j<>0 then begin  str(j,m);l:=m+l;end;
  add:=l;
end;
begin
  while not(eof) do
  begin
  read(x,y,z);
  str(x,a[0]);str(y,a[1]);str(z,a[2]);
  for i:=3 to 99 do
    begin
      a[i]:=add(a[i-3],a[i-2]);
      a[i]:=add(a[i-1],a[i]);
    end;
  writeln(a[99]);
  end;
end.
提交显示WA,可上面大神给的数据我全对。。。

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