fork(3) download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. string Column (long x)
  5. {
  6. string tmp = "";
  7. char c;
  8. while (1)
  9. {
  10. if (x==0) break;
  11. x--;
  12. c = 'A' + x%26;
  13. tmp = c + tmp;
  14. x = x/26;
  15. }
  16. return tmp;
  17. }
  18.  
  19. int main ()
  20. {
  21. char tmp;
  22. long r, c;
  23. while (1)
  24. {
  25. cin>>tmp>>r>>tmp>>c;
  26. if (r==0 && c==0) break;
  27. cout<<Column(c)<<r<<endl;
  28. }
  29. return 0;
  30. }
Success #stdin #stdout 0s 4468KB
stdin
R1C1
R3C1
R1C3
R299999999C26
R52C52
R53C17576
R53C17602
R0C0
stdout
A1
A3
C1
Z299999999
AZ52
YYZ53
YZZ53