[ create a new paste ] login | about

Link: http://codepad.org/3hO79XBH    [ raw code | output | fork ]

outoftime - C++, pasted on Dec 19:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#include <iostream>

using namespace std;

int main()
{
    int b = 0;
    for (int i = 10; i < 10000; ++i)
    {
        int k = i, k2, k3 = 0;
        k2 = k*k;
        while (k)   {
            k3 += (k % 10)*(k % 10)*(k % 10);
            k /= 10;
        }
        (k2 == k3) ? (++b) : (b = b);
    }
    cout << b << endl;
    return 0;
}


Output:
1
0


Create a new paste based on this one


Comments: