题解 | 数列求和

public class Main {
    public static void main(String[] args) {

        //write your code here........

        long n = 9;
        long sum = 9;
        long m;
        for (int i = 1; i <10; i++) {
            m = (long)Math.pow(10, i);
            n = n + m*9;
            sum += n;
        }
        System.out.println(sum);

    }
}

循环九次

全部评论

相关推荐

09-23 14:45
贵州大学 财务
勇敢求职牛牛:怎么9.2佬人手一个中信证券实习
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务