Author |
Message |
jonlumb
Spends far too much time on here
Joined: Thu Apr 23, 2009 6:44 pm Posts: 4141 Location: Exeter
|
Ok, currently working on problem 5, using the code below, keep on getting an error regarding an 'unresolved external symbol' and I cannot for the love of Geoff work out why it is giving me this. Have renamed every variable going just incase I was using something that was already named and tried commenting out pretty much everything after the int main() but cannot see what's giving the problem.
_________________ "The woman is a riddle inside a mystery wrapped in an enigma I've had sex with."
|
Sun Aug 21, 2011 6:17 pm |
|
 |
Fogmeister
I haven't seen my friends in so long
Joined: Thu Apr 23, 2009 7:35 pm Posts: 6580 Location: Getting there
|
Try removing the "using std..." bit and put "using namespace std;" as the line after the include line at the beginning. Seems ok apart from that though. --- I am here: http://maps.google.com/maps?ll=53.851236,-1.530917
|
Sun Aug 21, 2011 6:42 pm |
|
 |
jonlumb
Spends far too much time on here
Joined: Thu Apr 23, 2009 6:44 pm Posts: 4141 Location: Exeter
|
Found the cause, I'd selected the wrong project types when creating the project in VS, set that correctly and everything works. The function itself isn't working properly mind, but that's a different matter entirely  EdIt: It does if you don't comment out your final print screen of the answer! 
_________________ "The woman is a riddle inside a mystery wrapped in an enigma I've had sex with."
|
Sun Aug 21, 2011 6:44 pm |
|
 |
Fogmeister
I haven't seen my friends in so long
Joined: Thu Apr 23, 2009 7:35 pm Posts: 6580 Location: Getting there
|
Woop! Done number 81 now! Runs in about 0.001 seconds  LOL!
|
Sun Aug 21, 2011 9:26 pm |
|
 |
Fogmeister
I haven't seen my friends in so long
Joined: Thu Apr 23, 2009 7:35 pm Posts: 6580 Location: Getting there
|
13 and 25 done! Wrote my own set of functions to add numbers together in string form and then used these to work out both of the problems. Somehow I don't think 1000 digit numbers are covered by 32 bit ints.  Will be working on 82 and 83 tonight. Can solve them both with the same program (ish) but need to write the setup first.
|
Mon Aug 22, 2011 11:59 am |
|
 |
finlay666
Spends far too much time on here
Joined: Thu Apr 23, 2009 9:40 pm Posts: 4876 Location: Newcastle
|
got the start & end digit on 79, just 6 digits to go.... so just 720 (minimum) combinations left 
_________________TwitterCharlie Brooker: Macs are glorified Fisher-Price activity centres for adults; computers for scaredy cats too nervous to learn how proper computers work; computers for people who earnestly believe in feng shui.
|
Mon Aug 22, 2011 1:06 pm |
|
 |
jonlumb
Spends far too much time on here
Joined: Thu Apr 23, 2009 6:44 pm Posts: 4141 Location: Exeter
|
Problem 79 done by 'observation', was reasonably straight forward. Would be quite a lot harder to program I suspect.
_________________ "The woman is a riddle inside a mystery wrapped in an enigma I've had sex with."
|
Mon Aug 22, 2011 1:48 pm |
|
 |
Fogmeister
I haven't seen my friends in so long
Joined: Thu Apr 23, 2009 7:35 pm Posts: 6580 Location: Getting there
|
OK, I've got a program that will solve problem 14 but becuase it's done at work it doesn't have the capacity to store enough entries for the recursive program.
Will have to re-do it in C++ at home tonight.
|
Mon Aug 22, 2011 2:20 pm |
|
 |
finlay666
Spends far too much time on here
Joined: Thu Apr 23, 2009 9:40 pm Posts: 4876 Location: Newcastle
|
See I see that as cheating for a problem like this, the whole idea is to program every problem, doing by observation without thinking the process through completely is a different matter to doing it in code BigInteger in .net is enough 
_________________TwitterCharlie Brooker: Macs are glorified Fisher-Price activity centres for adults; computers for scaredy cats too nervous to learn how proper computers work; computers for people who earnestly believe in feng shui.
|
Mon Aug 22, 2011 2:37 pm |
|
 |
forquare1
I haven't seen my friends in so long
Joined: Thu Apr 23, 2009 6:36 pm Posts: 5151 Location: /dev/tty0
|
I wish I were better at maths. I've done a few in Perl, but when it started to talk about prime factors, I get somewhat scared off...
|
Mon Aug 22, 2011 2:45 pm |
|
 |
Fogmeister
I haven't seen my friends in so long
Joined: Thu Apr 23, 2009 7:35 pm Posts: 6580 Location: Getting there
|
I've got the BigInteger library for C++ at home but wanted to try doing it without using a pre-written library. I was trying to use it using the string library I've written at work. It takes strings of any length and can add them together and also divide them by 2.  I'm quite pleased with it 
|
Mon Aug 22, 2011 2:57 pm |
|
 |
rustybucket
I haven't seen my friends in so long
Joined: Thu Jun 18, 2009 5:10 pm Posts: 5836
|
I think I may have to try some these... ... but I think I'll try them in Ada 
_________________Jim
|
Mon Aug 22, 2011 3:40 pm |
|
 |
finlay666
Spends far too much time on here
Joined: Thu Apr 23, 2009 9:40 pm Posts: 4876 Location: Newcastle
|
First one I did I ended up writing my own library before finding out it was covered in System.Numerics
_________________TwitterCharlie Brooker: Macs are glorified Fisher-Price activity centres for adults; computers for scaredy cats too nervous to learn how proper computers work; computers for people who earnestly believe in feng shui.
|
Mon Aug 22, 2011 9:59 pm |
|
 |
rustybucket
I haven't seen my friends in so long
Joined: Thu Jun 18, 2009 5:10 pm Posts: 5836
|
No. 1 done in Ada - after learning how to do it again 
_________________Jim
|
Tue Aug 23, 2011 4:39 pm |
|
 |
Fogmeister
I haven't seen my friends in so long
Joined: Thu Apr 23, 2009 7:35 pm Posts: 6580 Location: Getting there
|

Finn, when you said you did 14 and it worked pretty quickly, how quickly did it run?
Also what number type did you use to store the lengths and values?
I'm using a recursive function to store all values in an array but I have to use BigIntegers for the lengths and the values otherwise I get stupid nonsense answers.
Also, even though I'm storing all previously encountered lengths it still takes 74 seconds to run. The function works so that if I was to start at 3 (for example) when it finishes running it would have stored the lengths for 3, 10, 5, 16, 8, 4, 2 and 1 (if I just did 3 that is without doing 2 and 1 before it).
It runs the function 3 million times which on a C2D 2.4GHz should take that amount of time (but I do have iTunes playing music and Safari open at the same time).
The only thing I can think is that taking the time up is BigInteger and when looking through the solution forum they have been able to use longs and unsigned longs but these just don't work for me.
Are there differences that would cause one person's long to be different from another person's?
|
Tue Aug 23, 2011 9:35 pm |
|
|