Here's my submission. It is password protected, btw, so no need to cheat.
Last edited by Sang-drax : Tomorrow at 02:21 AM. Reason: Time travelling
Alright, thanks for participating Sang-drax. Don't forget to publish the password the day the contest ends.
I would like to add that when I say it has to be in C/C++, inline assembly is also accepted (of course), as long as it's incorporated through a C/C++ program and compile on gcc and run on the target architecture. And for those who would like this extra information:
sizeof(int) = 4
sizeof(long) = 8
Last edited by laserlight; 05-28-2008 at 05:11 AM.
I hate real numbers.
ok, so an array of ~21 million bytes shoudl suffice to hold the largest value you specified (1 million), although 2^32-1 would require around 205 gigabytes of ram just for teh answer, so Im going to go ahead and just assume you wont give an input larger than 1 million. At that rate, assuming you can get the multiply for free adn just have to transfer the answer each iteration, adn only once, you are lookign at around 80+ minutes run time for 1000000!
I wasn't joking when I said that there were optimizations for large N, obviously. These are algorithm changes too, not just unrolling loops or something like that.