Hello everyone, my algorithms teacher told us to look for an algorithm solving this problem and explaining it, help is very appreciated as we are not that deep into algorithms yet.
Given a list of 4, 5, 6 ... or 10 integers (between 1 and 100) find the way of getting another integer between 1 and 2000, using only the basic operations: add, substract, multiply and divide. each number in the list can only be used once.
challenge: design, implement and document a solution to the problem, faster than the example program (which I will link later", for sizes between 6 and 10, and that it cannot lose a solution, the program must indicaite all the reachable numbers between 1 and 2000, using the input data.
here is the link, if you need help understanding it just let me know, drop me a message or something
http://dis.um.es/~gi...iles/cifras.exe
thanks in advance!
Cipher Challenge School Project
Started by AlfredoG4, Jun 19 2008 04:20 PM
3 replies to this topic
#1
Posted 19 June 2008 - 04:20 PM
|
|
|
#2
Posted 04 July 2008 - 03:12 PM
Hi, here's how I interpret what you said. Given a list of 6-10 integers between 1 and 100, you are to make an algorithm that always produces some number between 1 and 2000. The algorithm should be ONTO with the values between 1 and 2000, meaning that that for each value between 1 and 2000, there is some set of 6-10 inputs that will result in that that value.
If my interpretation is correct, this is basically a hashing/hash problem, and that's a good place to start looking for research. (though most hashing uses modulus operator which you say you don't have) Beyond that, I recommend you just break it down. Take one input case (6 numbers in for instance) and forget about the others. Find a way you can make an algorithm that is onto with all positive integers, then look at a way you can guarantee that you can keep that number less than 2000 after that. After the special case, look at the other numbers of inputs.
If my interpretation is correct, this is basically a hashing/hash problem, and that's a good place to start looking for research. (though most hashing uses modulus operator which you say you don't have) Beyond that, I recommend you just break it down. Take one input case (6 numbers in for instance) and forget about the others. Find a way you can make an algorithm that is onto with all positive integers, then look at a way you can guarantee that you can keep that number less than 2000 after that. After the special case, look at the other numbers of inputs.
#3
Posted 04 July 2008 - 09:43 PM
Oh, and above is the academically interesting way, but the quick and dirty way would be just to take the last digit of 4 of the input numbers and use it to construct the number between 1-2000...
#4
Posted 05 July 2008 - 06:49 AM
Making a modulus is easy. It's just x - ((x / y) * y). Hence you have modulus.


Sign In
Create Account

Back to top









