华为OD机试,case怎么都只有10%
实在想不到哪里有问题
package main.test;
import java.util.Scanner;
/**
* 创建工号,例如 a1,aa1,aa01
* 根据人数生成工号,求工号中数字最短长度,比如a1,数字最短为1,aa01,数字最短为01,不能全为字母或者全为数字
* x表示人数,y表示字母数
* 输入x(0<x<2^50-1),y(0<y<=5)
* 输入:26 1
* 输出:1
* 输入:260 1
* 输出:1
* 输入:2600 1
* 输出:2
*/
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
while (scanner.hasNextInt()) {
int x = scanner.nextInt();
int y = scanner.nextInt();
if (x < 1) {
break;
}
if (y < 1 || y > 5) {
break;
}
double wordCount = Math.pow(26, y);
int i = 0;
double a = 0;
while (a < x) {
i++;
a = wordCount * Math.pow(10, i);
}
System.out.println(i);
}
}
}