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 190111549 at 2010-09-22 20:36:53 on Problem 1546
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:
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