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 |
我哪里错呢。求高手大虾指教const ch:string[20]=('0123456789ABCDEFGHIJ'); var str:string;a:array[1..20]of integer;i,k,m,n,l:Longint; begin while not eof do begin readln(str);n:=0;fillchar(a,sizeof(a),0);l:=0;m:=0;k:=0; for i:=1 to 7 do if str[i]<>' ' then if str[i]>='A' then a[8-i]:=ord(str[i])-55 else a[8-i]:=ord(str[i])-48; val(copy(str,9,2),k);val(copy(str,12,2),m); for i:=1 to 7 do if a[i]<>0 then inc(n,trunc(exp((i-1)*ln(k))*a[i])); fillchar(a,sizeof(a),0); while n>0 do begin inc(l);a[l]:=n mod m;n:=n div m;end; if l>7 then writeln(' ERROR') else begin for i:=7 downto l+1 do write(' '); for i:=l downto 2 do write(ch[a[i]+1]); writeln(ch[a[1]+1]); end;end; end. Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator