#include <iostream>
#include <ctime>
#include <cmath>
#include <set>
using namespace std;
int main()
{
clock_t start = clock();
int total = 0;
set<double> answer;
for (double a = 2; a <= 100; a++)
for (double b = 2; b <= 100; b++)
answer.insert (pow (a, b));
total = answer.size ();
cout << total << endl
<< "Process took " << (static_cast<double> (clock()) - start) / CLOCKS_PER_SEC << " seconds." << endl;
system("pause");
return 0;
}
Monday, November 17, 2008
Problem #29
This is some elses solution, really short and simple. I am posting this instead of mine because mine was a long process using Notepad++, Mathematica, and C++. I used Mathematica to generate the tables, Notepad++ to split everything onto seperate lines, then C++ to read in the file, sort it, and delete any duplicates. It then output the total number of remaining elements.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment