C++ Shape Area
long long shapeArea(long long n)
{
return n > 1 ? shapeArea(n - 1) + 4 * (n - 1) : 1;
}
This returns the area of the growing n-interesting polygon using the direct formula instead of building the shape.
long long shapeArea(long long n)
{
return n > 1 ? shapeArea(n - 1) + 4 * (n - 1) : 1;
}
This returns the area of the growing n-interesting polygon using the direct formula instead of building the shape.