题解 | #尼科彻斯定理#

尼科彻斯定理

https://www.nowcoder.com/practice/dbace3a5b3c4480e86ee3277f3fe1e85

package com.example.demo.simple;

import java.util.Scanner;

public class Main_39 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int nextInt = sc.nextInt();

        int startNum = nextInt * (nextInt - 1) + 1;
        for (int i = 0; i < nextInt; i++) {
            System.out.print((i == nextInt - 1)? startNum : startNum + "+");
            startNum = startNum + 2;
        }
        System.out.println();
    }
}

全部评论

相关推荐

04-08 23:37
已编辑
东华大学 结构工程师
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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