题解 | #HJ076 尼科彻斯定理#
尼科彻斯定理
http://www.nowcoder.com/practice/dbace3a5b3c4480e86ee3277f3fe1e85
import java.util.Scanner;
/**
* HJ76 尼科彻斯定理 - 简单
*/
public class HJ076 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
while (sc.hasNext()) {
int n = sc.nextInt();
int start = n * (n - 1) + 1;
int end = n * (n + 1) - 1;
for (int i = start; i <= end; i += 2) {
if (i == end) {
System.out.println(i);
} else {
System.out.print(i + "+");
}
}
}
sc.close();
}
}
查看17道真题和解析
vivo公司福利 368人发布