hdu 1249 三角形

题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1249

part=3*s*(s-1)+2

 1 #include<stdio.h>
 2 #include<math.h>
 3 main()
 4 {
 5     int n,s,i,p,m;
 6     while(~scanf("%d",&n))
 7     {
 8         for(i=1;i<=n;i++)
 9         {
10             scanf("%d",&s);
11             p=3*(s-1)*s + 2;
12             printf("%d\n",p);
13         }
14     }
15 }

 

posted @ 2015-10-28 11:29  pter  阅读(131)  评论(0编辑  收藏  举报