Skip to content

Instantly share code, notes, and snippets.

@riverar
Last active June 30, 2020 18:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save riverar/d50eeb03e9f87deb6f3bf6a2fc3d8175 to your computer and use it in GitHub Desktop.
Save riverar/d50eeb03e9f87deb6f3bf6a2fc3d8175 to your computer and use it in GitHub Desktop.
#include <iostream>
#include <windows.h>
int zero = 0; // Can't seem to make this a local or delete it.
int main()
{
int iterations = 0, sort = 0, maxvis = 0, i = 0, i2 = 0, qx0 = 0, qy0 = 0, ix = 0, iy = 0, qx1 = 0, qy1 = 0, qx2 = 0, qy2 = 0;
qy0 = qx0 = static_cast<int>(std::floor(0)); // These can be re-ordered but not reduced.
qy0 = qx0;
if (zero) // Can't remove this.
i2 = 12;
else
i2 = 15;
if (i2 < 2) i2 = 2; // Nor this.
qx1 = -15;
qy1 = -15;
qx2 = qx0 + 15;
qy2 = 15;
maxvis = i2;
for (iy = qy1; iy <= qy2; iy++)
{
for (ix = qx1; ix <= qx2; ix++)
{
i2 = iy - qy0; // Nor this.
if ((ix * ix + i2 * i2) > (maxvis * maxvis)) continue; // Can't touch this either.
sort++;
iterations++;
if (sort >= 961) break;
}
if (sort >= 961) break;
}
std::cout << iterations << " " << sort;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment