出这种题的意义是啥,还放在最后面100
等差数列
https://www.nowcoder.com/practice/f792cb014ed0474fb8f53389e7d9c07f
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int n = scanner.nextInt();
int count = 0;
for (int i = 0, k = 2; i < n; i++, k += 3) {
count += k;
}
System.out.println(count);
}
}
查看10道真题和解析