Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<cstdio>
- #include<cmath>
- #include<map>
- #include<algorithm>
- #define MAX 1012
- using namespace std;
- map<int,int>mymap;
- int store[50000];
- int main()
- {
- int i,j,c=0;
- for(i=1;i<=MAX;i++)
- for(j=i;j<=MAX;j++)
- {
- int Icube=i*i*i;
- int Jcube=j*j*j;
- int sum=Icube+Jcube;
- if(mymap[sum]) {store[c++]=sum;}
- else mymap[sum]=1;
- }
- sort(store,store+c);
- int up,low;
- while(scanf("%d%d",&low,&up)==2)
- {
- up=up+low;
- for(i=0;i<c;i++)
- {
- if(store[i]>up) break;
- if(store[i]>=low)
- printf("%d\n",store[i]);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement