题目传送门: http://codeforces.com/contest/716/problem/C
题意:x = 2,k = 1,m满足sqrt(x+mk) mod (k+1) == 0,然后x = sqrt(x+mk),k=k+1 ,求使得k从1到n的n个m,m无需最优,只要满足题意即可
思路:一道推公式题,不难,结果就是m = k*(k+1)*(k+1)-(k-1),当k=1时特判 m = 2
代码如下:
#include <iostream>
#include <algorithm>
#include <cstring>
#include <stdio.h>
#include <string>
#include <cmath>
#include <queue>
#include <set>
#include <map>
#include <stack>
#include <bitset>
using namespace std;
#define lson l,m,rt<<1
#define rson m+1,r,rt<<1|1
#define ll long long
#define ull unsigned long long
#define mem(n,v) memset(n,v,sizeof(n))
#define MAX 100005
#define MAXN 200005
#define PI 3.1415926
#define E 2.718281828459
#define opnin freopen("text.in.txt","r",stdin)
#define opnout freopen("text.out.txt","w",stdout)
#define clsin fclose(stdin)
#define clsout fclose(stdout)
#define haha1 cout << "haha1"<< endl
#define haha2 cout << "haha2"<< endl
#define haha3 cout << "haha3"<< endl
const int INF = 0x3f3f3f3f;
const ll INFF = 0x3f3f3f3f3f3f3f3f;
const double pi = 3.141592653589793;
const double inf = 1e18;
const double eps = 1e-8;
const ll mod = 1e18;
const ull mx = 133333331;
/**************************************************************************/
int main()
{
ll n;
cin >> n;
cout << "2" <<endl;
for(ll k=2;k<=n;k++) printf("%I64d\n",(k*(k+1)*(k+1) - k+1));
}