Created
October 15, 2021 17:20
-
-
Save goish135/b2e1a498d0fc5d1f1bdac1ddab273227 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<iostream> | |
using namespace std; | |
int main() | |
{ | |
int n,m; | |
cin >> n >> m; // [100,400] | |
int i = n; | |
int total = 0; | |
while(i<=m) | |
{ | |
//cout << "In" << endl; | |
int tmp; | |
tmp = i; | |
int sum=0; | |
while(tmp) | |
{ | |
int d; | |
d=tmp%10; | |
//print("d",d); | |
//cout << d << endl; | |
sum+=(d*d*d); | |
tmp/=10; | |
} | |
//cout << sum << endl; | |
if(sum==i) | |
{ | |
cout << sum << endl; | |
total+=1; | |
} | |
i++; | |
} | |
cout << "total:" << total << endl; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment