共回答了24个问题采纳率:79.2%
按照你的要求写的如下代码,精短而高效,可以直接运行
public class Luck {
x09public static void main(String[] args) {
x09x09int count = 1237;//count,手动指定范围
x09x09// 确定字符串的长度
x09x09int length = 1;
x09x09int temp = count;
x09x09while ((temp = temp / 26) > 0) {
x09x09x09length++;
x09x09}
x09x09// 从1输出到count
x09x09for (int a = 1; a 0) {
x09x09x09x09s = (char) ('A' + i % 26) + s;
x09x09x09x09i = (i - i % 26) / 26;
x09x09x09}
x09x09x09while (s.length() < length) {
x09x09x09x09s = 'A' + s;
x09x09x09}
x09x09x09System.out.println(s);
x09x09}
x09}
}
1年前
追问
2