publicstaticvoidsolve() { inta= io.nextInt(), b = io.nextInt(); if (a > b) { intt= a; a = b; b = t; } if (a % 2 == 0 || b % 2 == 0 && b != 2 * a) { io.println("Yes"); } else { io.println("No"); } }
publicstaticvoidsolve() { intn= io.nextInt(), x = io.nextInt(); Set<Integer> set = newHashSet<>(); calc(n - x, x, set); calc(n + x - 2, x, set); io.println(set.size()); }
privatestaticvoidcalc(int x, int y, Set<Integer> set) { if (x % 2 != 0) { return; } x /= 2; for (inti=1; i <= x / i; i++) { if (x % i == 0) { if (i + 1 >= y) { set.add(i + 1); } if (x / i != i && x / i + 1 >= y) { set.add(x / i + 1); } } } }
publicstaticvoidsolve() { intn= io.nextInt(), b = io.nextInt(), x = io.nextInt();
intm=0; int[] c = newint[n]; for (inti=0; i < n; i++) { c[i] = io.nextInt(); m = Math.max(m, c[i]); }
long[] f = newlong[m + 1]; long[] g = newlong[m + 1]; for (inti=0; i < n; i++) { for (intj=1; j <= c[i]; j++) { f[j] += calc(c[i], j); } g[c[i]] += calc(c[i], c[i]); }
longans=0L; for (inti=1; i <= m; i++) { ans = Math.max(ans, (f[i] + g[i - 1]) * b - (long) (i - 1) * x); g[i] += g[i - 1]; } io.println(ans); }
privatestaticlongcalc(int n, int k) { inta= n / k, b = n % k; longres= (long) (k - b) * (k - b - 1) / 2 * a * a; res += (long) b * (b - 1) / 2 * (a + 1) * (a + 1); res += (long) (k - b) * b * a * (a + 1); return res; }