zoukankan
html css js c++ java
经尉迟方兄提点,终于明白为什么不是一个简单的26进制程序了
题目如下:
用过excel的都知道excel的列编号是这样的:
a b c .... z
aa
ab ac .... az ba bb bc .... yz za zb zc .... zz
aaa
aab aac ....
分别代表以下编号:
1 2 3 .... 26 27 28 29 .... 52 53 54 55 .... 676 677 678 679 .... 702 703 704 705 ....
请写个函数,完成从一个正整数到这种字符串之间的转换。
Public
Function intcstr()
Function
intcstr(
ByVal
ints
As
Integer
)
As
String
Dim
strs
As
String
strs
=
Nothing
Do
While
(ints
Mod
26
)
<>
0
Or
ints
/
26
<>
0
If
ints
Mod
26
=
0
Then
ints
=
ints
/
26
-
1
strs
=
Chr
(
96
+
26
)
&
strs
Else
strs
=
Chr
(
96
+
(ints
Mod
26
))
&
strs
ints
=
Int
(ints
/
26
)
End
If
Loop
Return
strs
End Function
查看全文
相关阅读:
PAT (Advanced Level) Practice 1071 Speech Patterns (25分)
PAT (Advanced Level) Practice 1070 Mooncake (25分)
PAT (Advanced Level) Practice 1069 The Black Hole of Numbers (20分)
PAT (Advanced Level) Practice 1074 Reversing Linked List (25分)
PAT (Advanced Level) Practice 1073 Scientific Notation (20分)
第一次冲刺个人总结01
构建之法阅读笔记01
人月神话阅读笔记01
四则运算2
学习进度条(软件工程概论1-8周)
原文地址:https://www.cnblogs.com/aowind/p/136898.html
最新文章
bzoj1334[Baltic2008]Elect(背包dp)
bzoj1606[Usaco2008 Dec]Hay For Sale 购买干草(01背包)
bzoj1708[Usaco2007 Oct]Money奶牛的硬币(背包方案数dp)
洛谷P1077 摆花(背包dp)
bzoj1030 文本生成器(AC自动机+dp)
hdu 2222 Keywords Search
bzoj 3172 单词
P1070 道路游戏
6.11 学校模拟
poj2960 S-Nim
热门文章
poj2975 Nim(经典博弈)
bzoj 1503郁闷的出纳员(splay)
初识vue
自定义分页器 及使用
Django的model form组件
PAT (Advanced Level) Practice 1015 Reversible Primes (20分) (进制转换+素数判断)
PAT (Advanced Level) Practice 1013 Battle Over Cities (25分) (使用DFS对图的强连通分量的统计)
PAT (Advanced Level) Practice 1010 Radix (25分) (进制转换 longlong溢出 二分查找)
PAT (Advanced Level) Practice 1004 Counting Leaves (30分) (普通树的DFS)
进制转换(2~16进制)
Copyright © 2011-2022 走看看