Posted on 2008-12-17 21:37
Hero 阅读(259)
评论(0) 编辑 收藏 引用 所属分类:
代码如诗--ACM
1 //Accepted 2050 15MS 0K 343 B C++ HDU
2
3 //折线分割平面
4 //f(n) = (2n)(2n+1)/2 -(2n) + 1 ;
5
6 #include <iostream>
7
8 using namespace std ;
9 typedef long long llong ;
10
11 int innum ;
12 int inn ;
13
14 int main()
15 {
16 while( scanf( "%d", &innum ) != EOF )
17 {
18 while( innum-- )
19 {
20 scanf( "%d", &inn ) ;
21
22 llong out = 0 ;
23
24 out = (2*inn)*(2*inn+1)/2 - 2*inn + 1 ;
25
26 printf( "%lld\n", out ) ;
27 }
28 }
29
30 return 0 ;
31 }