找规律,怎么可能难道我这个数学学霸(哈哈仅限于初中)
高中之后数学就不行了,说多了都是泪
import java.util.*;
public class Main{
public static String GetSequeOddNum(int m) {
int cuBicSum = m*m*m;
String[] num = new String[m];
int mid = cuBicSum/m;
int cur = mid - (m - 1);
for (int i = 0; i < num.length; i++,cur += 2) {
num[i] = cur + "";
}
String result = "";
for (int i = 0; i < num.length; i++) {
if (i == num.length - 1){
result = result + num[i];
break;
}
result += num[i] + "+";
}
return result;
}
public static void main(String[] args){
Scanner in = new Scanner(System.in);
while(in.hasNext()){
int m = in.nextInt();
System.out.println(GetSequeOddNum(m));
}
}
}