题解 | #等差数列#
等差数列
http://www.nowcoder.com/practice/f792cb014ed0474fb8f53389e7d9c07f
public class Main {
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
if(sc.hasNext()){
int num = sc.nextInt();
int sum = 0;
for(int i =0;i<num;i++){
sum +=count(i);
}
System.out.print(sum);
}
}
public static int count(int i){
if(i==0){
return 2;
}
return count(i-1)+3;
}
}