题目大意: 给你n个三角形,算出三角形切割出的平面数。 解题思路: 没啥思路,直接就yy,额,写出数据。 1…………1+1 2…………1+1+6 3…………1+1+6+12 4…………1+1+6+12+18 看出啥,好吧,6的倍数递增。 吐吐槽: 表示一开始只推出了三组,然后就yy了,以为是按6,12,24,48增加的,没想到第三组居然是18,看来yy也要多弄几组才行。 代码:
#include
using namespace std;
int main(void)
{
    int cas;
    scanf("%d", &cas);
    while(cas--)
    {
        int n;
        scanf("%d", &n);
        __int64 ans = 2, temp = 6;
        for(int i = 0; i < n - 1; i++)
        {
            ans += temp;
            temp += 6;
        }
        printf("%I64d\n", ans);
    }
    return 0;
}
posted on 2012-02-13 01:00  cchun  阅读(252)  评论(0编辑  收藏  举报