程式語言 - LeetCode - C - 2579. Count Total Number of Colored Cells



題目:


解答:

long long coloredCells(int n)
{
    int i = 0;
    long long cc = 1;

    for (i = 0; i < n; i++) {
        cc += (i * 4);
    }
    return cc;
}