#include #include #define MAXN 40 #define SLICE 1000000ll #define MAX 1000ll*SLICE int subdivs[SLICE]; long long a[MAXN+1]; int main() { memset(a, 0, sizeof(a)); int wanted = 1; for (long long min=0; min d^2 long long m1 = d*d+d; if (m1>max) { break; } // m2 = least multiple of d >= min long long m2 = d * (min/d); if (m2 < min) { m2 += d; } long long m = (m1MAXN) { return 0; } } } return 0; }