题解 | 数列求和

数列求和

https://www.nowcoder.com/practice/6893484c04c24bfca1f606b1823a468d

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

        //write your code here........
        
        long max = 9999999999L;
        long result = 0L;
        for(long temp = 9; temp <= max; ){
            result += temp;
            temp = temp * 10 + 9;   
        }
        System.out.println(result);
    }
}

全部评论

相关推荐

点赞 评论 收藏
分享
08-01 11:19
电气工程师
我懒羊羊觉得没问题:写的太学生化了,像作文一样,很难看出你和岗位的匹配度
点赞 评论 收藏
分享
no_work_no...:大专三年最辛苦的应该是手机和电脑了吧
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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