| ||||||||||
| 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 | |||||||||
我是猪,Why RE?(附程序)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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator