2 1 2
2 7
代码:
/*折线分割平面最大分割 F(N) = F(N-1)*4*(N-1)+2-1; = 2*N^N-N+1; */ #include <stdio.h> #include <string.h> int ans[10005] = {0}; void f(){ int i; ans[1] = 2; for(i = 2; i <= 10005; i ++) ans[i] = ans[i-1]+4*(i-1)+1; } int main(){ f(); int t, n; scanf("%d", &n); while(n --){ scanf("%d", &t); printf("%d\n", ans[t]); } return 0; }
原文:http://blog.csdn.net/shengweisong/article/details/40798737