https://code.mi.com/problem/list/view?id=142
暴力。
1 #include <bits/stdc++.h> 2 using namespace std; 3 const int N = 1e7+7; 4 int vis[N]; 5 int a,b,c,d,e; 6 int main(){ 7 ios::sync_with_stdio(false); 8 cin>>a>>b>>c>>d>>e; 9 for(int i=-50;i<=50;i++){ 10 if(!i)continue; 11 for(int j=-50;j<=50;j++){ 12 if(!j)continue; 13 for(int k=-50;k<=50;k++){ 14 if(!k)continue; 15 int ans = a*i*i*i+b*j*j*j+c*k*k*k; 16 ans=abs(ans); 17 if(ans<=1e7)vis[ans]++; 18 } 19 } 20 } 21 int ans = 0; 22 for(int i=-50;i<=50;i++){ 23 if(!i)continue; 24 for(int j=-50;j<=50;j++){ 25 if(!j)continue; 26 int tmp = d*i*i*i+e*j*j*j; 27 tmp = abs(tmp); 28 if(tmp<=1e7)ans+=vis[tmp]; 29 } 30 } 31 cout<<ans/2<<endl; 32 }