题目地址:http://acm.hdu.edu.cn/showproblem.php?pid=2050
待定系数直接求出公式了
ax^2+bx+c
得
2*x*x-x+1
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <cctype>
#include <cmath>
#include <sstream>
#include <vector>
using namespace std;
#define REP(i,a,b) for(int i=a;i<(int)b;i++)
#define REPD(i,a,b) for(int i=a;i>=(int)b;i--)int main()
{int T,n; scanf("%d",&T);while(T--&&scanf("%d",&n)==1){printf("%d\n", 2*n*n-n+1);}return 0;
}