import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int count = scanner.nextInt(); while (count-- > 0) { int number = scanner.nextInt(); int start = 1; long result = 0; while (number > Math.pow(10, start)) { result += (Math.pow(10, start) - Math.pow(10, start - 1)) * start; start += 1; } if (number == Math.pow(10, start)) { result += 1; } result += (number - Math.pow(10, start - 1) + 1) * start; System.out.println(result); } } }
点赞 评论

相关推荐

码农索隆:竞争压力小,就你一个不用卷
点赞 评论 收藏
分享
牛客网
牛客网在线编程
牛客网题解
牛客企业服务