题解 | #等差数列#
等差数列
https://www.nowcoder.com/practice/f792cb014ed0474fb8f53389e7d9c07f
#include <iostream>
using namespace std;
int main() {
int x;
cin >> x;
int result = ((2 + 2 +3 * (x-1))*x/2);
cout << result;
}
直接掏公式
等差数列
https://www.nowcoder.com/practice/f792cb014ed0474fb8f53389e7d9c07f
#include <iostream>
using namespace std;
int main() {
int x;
cin >> x;
int result = ((2 + 2 +3 * (x-1))*x/2);
cout << result;
}
直接掏公式
相关推荐