Workspace
Người dùng nshn8c0000
Từ
Giới thiệu
tao bi gay thcih furry
#include<bits/stdc++.h>
using namespace std;
long long n;
int main()
{
ios_base::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
cin>>n;
while(n--)
{
string s;
cin>>s;
if(s[0]=='R' && s.find('C')!=string::npos && isdigit(s[1]))
{
int vt=s.find('C');
long long hang=stoll(s.substr(1,vt-1));
long long cot=stoll(s.substr(vt+1));
string kq="";
while(cot>0)
{
cot--;
kq=char('A'+cot%26)+kq;
cot/=26;
}
cout<<kq<<hang<<"\n";
}
else
{
int i=0;
while(isalpha(s[i])) i++;
string chu=s.substr(0,i);
long long hang=stoll(s.substr(i));
long long cot=0;
for(int j=0;j<chu.size();j++)
cot=cot*26+(chu[j]-'A'+1);
cout<<"R"<<hang<<"C"<<cot<<"\n";
}
}
}