/* -*- coding: utf-8 -*- * * 781.cc: No.781 円周上の格子点の数え上げ - yukicoder */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; /* constant */ const int MAX_R = 10000000; /* typedef */ /* global variables */ int cnts[MAX_R + 1]; /* subroutines */ /* main */ int main() { int r0, r1; scanf("%d%d", &r0, &r1); for (int y = 0, yy = 0; yy <= r1; y++, yy = y * y) for (int x = 1, xx = 1; xx + yy <= r1; x++, xx = x * x) cnts[xx + yy]++; int maxc = 0; for (int r = r0; r <= r1; r++) if (maxc < cnts[r]) maxc = cnts[r]; printf("%d\n", maxc * 4); return 0; }