Created
May 17, 2015 14:32
-
-
Save azyu/eeb868e37087ce6df991 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> | |
#include <string> | |
#include <cmath> | |
using namespace std; | |
int _tmain(int argc, _TCHAR* argv[]) | |
{ | |
int total = 0; | |
char buf[256]; | |
string s; | |
for(int i = 2; i < 999999 ; ++i) | |
{ | |
_itoa(i, buf, 10); | |
s = buf; | |
int sum = 0; | |
for each(char c in s) | |
{ | |
sum += pow(atof(&c), 5); | |
} | |
if( i == sum ) | |
{ | |
for each(char c in s) | |
{ | |
cout << c << "(" << pow(atof(&c), 5) << ") "; | |
} | |
cout << endl; | |
total += sum; | |
cout << "Sum: " << sum << " Total: " << total << endl; | |
} | |
} | |
cout << total << endl; | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment