# Excel Sheet Column Title

Given a positive integer, return its corresponding column title as appear in an Excel sheet.

For example:

```    1 -> A
2 -> B
3 -> C
...
26 -> Z
27 -> AA
28 –> AB ```

python给出的函数和参数是

```class Solution:
# @return a string
def convertToTitle(self, num):```

```>>> chr(65)
'A'
>>> chr(66)
'B'```

A * 26 + B = 1 * 26 + 2 = 28

A * 26 ^ 2 + B * 26 + C = num

```class Solution:
# @return a string
def convertToTitle(self, num):
str = ''
while num > 0:
a = num % 26
num /= 26
str = chr(a + 64) + str
return str```

```Submission Result: Wrong Answer
Input:	26
Output:	"A@"
Expected:	"Z"```

```class Solution:
# @return a string
def convertToTitle(self, num):
str = ''
tmp1 = num / 26
tmp2 = num % 26
if tmp1:
str = chr(26 + 64) * tmp1
if tmp2:
str += chr(tmp2 + 64)
return str```

`Submission Result: Memory Limit Exceeded`

```>>> a = 'hello'
>>> a * 100
'hellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohello'```

```class Solution:
# @return a string
def convertToTitle(self, num):
str = ''
tmp1 = num / 26
tmp2 = num % 26
while tmp1:
str += chr(26 + 64)
tmp1 -= 1
if tmp2:
str += chr(tmp2 + 64)
return str```

```Submission Result: Time Limit Exceeded

Last executed input:	1000000001```

```class Solution:
# @return a string
def convertToTitle(self, num):
str = ''
tmp1 = num / 26
tmp2 = num % 26
while tmp1:
str = ''.join([str, chr(26 + 64)])
tmp1 -= 1
if tmp2:
str += chr(tmp2 + 64)
return str```