## icpc 3143

Do you want to discuss about these problems? Go now!
Users are shared (no need to re-register).

Moderator: Board moderators

trulo17
Learning poster
Posts: 62
Joined: Mon Jan 24, 2005 6:12 am
Location: Lima,Peru

### icpc 3143

well, i didn't find any forum for this problem in the icpc board, so i decided to post here( by the way, few people post there ).

I have tested the code below with the original contest's input and i got exactly the same output, but when i send it to the judge it just gets wrong answer again and again.

#include<cstring>
#include<cstdio>
int main()
{
char A,T="1ABCDEFGHIJKLMNOPQRSTUVWXYZ";
int T1={1,26},T2={0,0};
int a,b,i,ct,cifras,t;
for( i = 2; i < 7; ++i )
{
T1 = T1*26;
T2 = T2 + T1;
}
while( gets( A ) )
{
if( strcmp( A, "R0C0" ) == 0 )
{
break;
}
sscanf( A, "R%dC%d", &a, &b );
char X = "";
for( i = 2; ; ++i)
{
if( T2 >= b )
{
cifras = i - 1;
b-=T2[cifras];
break;
}
}
for( i = cifras - 1, ct = 0; i > 0; --i, ++ct )
{
t = b % T1;
b/=T1;
if( t != 0 )
{
X[ct] = T[b + 1];
}
else
{
X[ct] = T;
for( ct = ct + 1, i = i - 1; i > -1; --i, ++ct )
{
X[ct] = 'Z';
}
X[ct] = '\0';
goto out;
}
b = t;
}
X[ct] = T;
X[ct + 1] = '\0';
out:
printf( "%s%d\n", X, a );
}
}

could somebody please explain what's going on?[/code]