题解 | #尼科彻斯定理#
尼科彻斯定理
http://www.nowcoder.com/practice/dbace3a5b3c4480e86ee3277f3fe1e85
import java.io.*; import java.util.*; public class Main{ public static void main(String[] args){ Scanner sc = new Scanner(System.in); while(sc.hasNextInt()){ System.out.println(fun(sc.nextInt())); } } public static String fun(int n){ StringBuilder sb = new StringBuilder(); int start = n * (n - 1) + 1; for(int i = 0; i < n; ++i){ sb.append(start + i * 2); sb.append("+"); } sb.deleteCharAt(sb.length()-1); return sb.toString(); } }