HDU1249_三角形切割平面

题目大意: 给你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;
}
原文地址:https://www.cnblogs.com/cchun/p/2520220.html