标签:inpu acm stdio.h math ble 个数 problem 分析 limit
传送门:
http://acm.hdu.edu.cn/showproblem.php?pid=2050
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 37696 Accepted Submission(s): 25230
#include<iostream> #include<stdio.h> #include<algorithm> #include<math.h> using namespace std; #define max_v 10005 //f(n)=f(n-1)+4*(n-1)+1,n>=3 int main() { long long f[max_v]; f[1]=2; f[2]=7; for(int i=3;i<max_v;i++) { f[i]=f[i-1]+4*(i-1)+1; } int t; scanf("%d",&t); int a; while(t--) { scanf("%d",&a); printf("%I64d\n",f[a]); } return 0; }
标签:inpu acm stdio.h math ble 个数 problem 分析 limit
原文地址:https://www.cnblogs.com/yinbiao/p/9371164.html