競プロ開始初日の明が解いた問題。満点のコードです ```cpp= #include <bits/stdc++.h> using namespace std; using ll = long long; int main () { ll N,M; cin>>N>>M; unsigned int cnt = 0; // cbrt(N) as maximum of A for (ll a=1; a*a*a<=N; a++) { auto bc = N / a; auto b_plus_c = M - a; // Calculate b and c using x^2 + (b+c)x + bc = 0 auto left_side = b_plus_c / 2.0; auto right_side = sqrt(powl((b_plus_c), 2) / 4 - (bc)); auto b = left_side - right_side; auto c = left_side + right_side; // Skip non-integer values if (floor(b) != ceil(b) || floor(c) != ceil(c)) { continue; } if (a * b * c != N || a + b + c != M) { continue; } int cnt_to_add; if (a == b && b == c) { cnt_to_add = 1; } else if ((a != b && b == c) || (a == b && b != c) || (a != b && b != c && b*b*b <= N)) { cnt_to_add = 3; } else { cnt_to_add = 6; } //cout<<a<<" "<<b<<" "<<c<<" "<<cnt_to_add<<endl; // debug cnt += cnt_to_add; } cout<<cnt<<endl; return 0; } ```