- 等差数列得通项公式 ai = a1+ (i-1)*d;
#include<bits/stdc++.h>
using namespace std;
int main(){
int in; while(cin>>in){ int a1 = 2, d = 3; int sum = 0; for(int i = 1; i <= in;i++){ sum += a1+ (i-1)*d; } cout<<sum<<endl; } return 0;
}
```
#include<bits/stdc++.h>
using namespace std;
int main(){
int in; while(cin>>in){ int a1 = 2, d = 3; int sum = 0; for(int i = 1; i <= in;i++){ sum += a1+ (i-1)*d; } cout<<sum<<endl; } return 0;
}
```