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

我是猪,Why RE?(附程序)

Posted by JiangLY at 2005-06-25 22:36:23 on Problem 2273
const
  list:array[1..26] of string[1]=('A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z');
var
  s,ans:string;
  a,b,c,i,j,k,l,n,m,p:longint;
begin
  while true do
    begin
      readln(s);
      if s='R0C0' then halt;
      p:=pos('C',s);
      val(copy(s,2,p-2),a,c);
      val(copy(s,p+1,length(s)-p),b,c);
      ans:='';
      l:=1;
      m:=b;
      while m>1 do
        begin
          m:=m div 26;
          l:=l*26;
        end;
      while b>26 do
        begin
          l:=l div 26;
          if b mod 26=0 then
                          begin
                            ans:=ans+list[b div l-1];
                            b:=b-(b div l-1)*l;
                          end
                        else
                          begin
                            ans:=ans+list[b div l];
                            b:=b-(b div l)*l;
                          end;
        end;
      ans:=ans+list[b];
      writeln(ans,a);
    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