#include <iostream> using namespace std; int main() { int x; cin >> x; int result = ((2 + 2 +3 * (x-1))*x/2); cout << result; }
直接掏公式
#include <iostream> using namespace std; int main() { int x; cin >> x; int result = ((2 + 2 +3 * (x-1))*x/2); cout << result; }
直接掏公式