Questions asked
analysis
This essay, you see him Data 2 32 -1, no good, not a solid foundation might think that this is the standard int, Definitely No ......
int 2 31 -1 as the upper limit, ha ha ha ......
The program is free and count every 7 out, because each one is independent of each other, so add up to answer it.
AC Code (Java description language)
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
List<Long> list = new ArrayList<>(1000);
Scanner scanner = new Scanner(System.in);
int num = Integer.parseInt(scanner.nextLine());
for (int i = 0; i < num; i++) {
long limit = Long.parseLong(scanner.nextLine());
long temp, result = 0, j = 1;
while (limit != 0) {
temp = limit % 10;
if (temp >= 7) {
temp--;
}
result += (j * temp);
limit /= 10;
j *= 9;
}
list.add(result);
}
scanner.close();
for (long i : list) {
System.out.println(i);
}
}
}