【Henu ACM Round#17 D】Hexagons!

【链接】 我是链接,点我呀:)
【题意】

在这里输入题意

【题解】

题目的图吓人。 找下规律就会发现从内到外是1,6,12,18 即1,1*6,2*6,3*6... 即1+6*(1+2+3+...) 等差求和公式。

【代码】

#include <bits/stdc++.h>
#define ll long long
using namespace std;

ll n;

int main()
{
    ios::sync_with_stdio(0),cin.tie(0);
    #ifdef LOCAL_DEFINE
        freopen("rush.txt","r",stdin);
    #endif // LOCAL_DEFINE
    cin >> n;
    ll temp = (1+n)*n/2;
    cout <<1+temp*6<<endl;
    return 0;
}
原文地址:https://www.cnblogs.com/AWCXV/p/8365512.html