Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
不停的WA,基本上把所有可能的情况都写进去了~!!!请帮忙看下var f1,f2,f3:array[0..200]of integer; a:array[1..2,0..200]of integer; i,tot,k,t,j,l:integer; st:string; function check:boolean; var i:integer; begin check:=false; if f2[0]>a[2,0] then exit; if f2[0]<a[2,0] then begin check:=true;exit; end; for i:=f2[0] downto 1 do begin if f2[i]=a[2,i] then continue; if f2[i]<a[2,i] then begin check:=true;exit;end; exit; end; check:=true; end; function check_1:boolean; var i:integer; begin check_1:=false; if f2[0]<a[1,0]then exit; if f2[0]>a[1,0]then begin check_1:=true;exit;end; for i:=f2[0] downto 1 do begin if f2[i]=a[1,i] then continue; if f2[i]>a[1,i] then begin check_1:=true;tot:=1;exit;end; exit; end; tot:=1; check_1:=true; end; function check_e:boolean; var i:integer; begin check_e:=false; for i:=1 to l do if st[i]=' ' then break else if st[i]<>'0' then exit; for i:=i+1 to l do if st[i]=' 'then continue else if st[i]<>'0' then exit; check_e:=true; end; begin while not seekeof do begin tot:=0; fillchar(a,sizeof(a),0); fillchar(f1,sizeof(f1),0); fillchar(f2,sizeof(f2),0); k:=1;t:=1; readln(st); l:=length(st); if check_e then halt; for i:=1 to l do if st[i]=' ' then break else begin while (st[i]='0')and(st[i+1]<>' ') do begin delete(st,i,1); dec(l); end; break; end; for i:=i+1 to l do if st[i]=' 'then break; for i:=i+1 to l do if st[i]=' ' then continue else begin while (st[i]='0')and(st[i]<>' ') do begin delete(st,i,1); dec(l); end; break; end; for i:=l downto 1 do if not ((st[i]>='0')and(st[i]<='9')) then dec(l) else break; for i:=l downto 1 do if st[i]=' ' then break else begin a[2,l-i+1]:=ord(st[i])-48; inc(a[2,0]); end; l:=i-1; for i:=l downto 1 do if st[i]<>' 'then break else dec(l); for i:=l downto 1 do begin a[1,l-i+1]:=ord(st[i])-48; inc(a[1,0]); end; inc(t); f1[0]:=1;f2[0]:=1; f1[1]:=1;f2[1]:=2; while check do begin if tot>0 then inc(tot) else check_1; j:=0; f3:=f2; for i:=1 to f2[0] do begin f2[i]:=f1[i]+f2[i]+j; j:=f2[i] div 10; f2[i]:=f2[i] mod 10; end; if j<>0 then begin f2[i+1]:=j;inc(f2[0]); end; f1:=f3; end; if (a[1,0]=1)and((a[1,1]=0)or(a[1,1]=1)) then inc(tot); writeln(tot); end; end. Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator