在这个挑战中,你必须以一个数字作为输入,输出相应的字母,反之亦然。(1 <=> A,2 <=> B)等。
1 -> A
2 -> B
...
26 -> Z
A -> 1
B -> 2
...
Z -> 26A到Z的大写字母或从1到26的整数。发布于 2016-08-16 01:45:06
ú' +ûEí在网上试试!
解释:
ú' +ûEí
ú' + lowercase English alphabet, prepend space
û uppercase
E element (pushes the nth letter if input is an integer, leaves stack alone otherwise)
í index (pushes index of input if input is a string, leaves stack alone otherwise)如果小写可以接受,这是6个字节:
ú' +Eí在网上试试!
发布于 2016-08-15 22:05:55
f([X])->X-64;f(X)->[X+64].Erlang的字符串行为是有用的少数几次之一。
发布于 2016-08-16 00:26:45
lambda x:x>''and 64^ord(x)or chr(64^x)在艾德龙上进行测试。
https://codegolf.stackexchange.com/questions/89952
复制相似问题