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

没什么可说的,直接算就行了

Posted by demaxiya at 2012-08-28 10:12:56 on Problem 3982
type sb=array [1..100] of integer;
var
a:array [0..99] of sb;
s:string;
i,ij,k,max:integer;
function jia(a,b:sb):sb;
var
i:integer;
c:sb;
begin
fillchar(c,sizeof(c),0);
for i:=1 to max do
  begin
    c[i]:=c[i]+a[i]+b[i];
    if c[i]>9 then
      begin
         c[i]:=c[i]-10;
          c[i+1]:=1;
      end;
  end;
  if c[max+1]>0 then inc(max);
exit(c);
end;
begin
while not(eof) do
begin
fillchar(a,sizeof(a),0);
readln(s);
ij:=pos(' ',s);
max:=ij-1;
for i:=ij-1 downto 1 do a[0][i]:=ord(s[ij-i])-48;
delete(s,1,ij);
ij:=pos(' ',s);
if max<ij-1 then max:=ij-1;
for i:=ij-1 downto 1 do a[1][i]:=ord(s[ij-i])-48;
delete(s,1,ij);
ij:=length(s)+1;
if max<ij-1 then max:=ij-1;
for i:=ij-1 downto 1 do a[2][i]:=ord(s[ij-i])-48;
for i:=3 to 99 do
a[i]:=jia(a[i-1],jia(a[i-2],a[i-3]));
for i:= max downto 1 do write(a[99][i]);
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