It's a great contest that you have, absolutely challanging question that we programmers appreciate. However for this type of algorithm creation questions, I think we shall need a couple of sample data files.
Have you provided the data files somewhere that I have missed out? The only sample data that I found was on the main contests page, that too the data was trivial and any primitive alogorithm could easily crack that.
We need complicated stuff here so that we can build a good algo.
I didn't see any test data anywhere, but I've just been making my own test data...that's what I would recommend doing. Just pick some random numbers and a random answer...if the algorithm is good enough, it'll find it. My algorithm is rather crappy, and most random groups of numbers that I have tried have been solvable (as long as it's under about 30 of them, above that and you get a bit trickier). If you want to test a long string of numbers, I would suggest just making a larger problem that you know is solvable (ie, calculate an answer with 50 numbers using a random arrangement of operations). If you really want, I can post some of my own test data...
After analysing the problem for quite a long time, I don't believe parenthesis should be needed if the calculations are done right.
I suppose my question is regarding the script being able to take a load of 50 numbers at once. I believe the one test data is well suited for the lower end of the spectrum, but we should at least have 1 test data of at least 40 numbers recommended 50 numbers so that we can find out if our script takes over 55 seconds and be able to tweak it before submission. Is this possible? Thanks.
OK here is an example. Note that I have not rounded each seperate calculation to 2 decimal places in my solution (did'nt have the time).
First here is the list (without the answer):
65.3
1
52
7602.31
783.32
34.2
86.4
987.01
863.4
653.9
8.3
6.5
2.4
935.32
64.37
96.34
68.2
4.87
5.89
364.6
345.67
862.54
753.59
239.32
9
Here is the answer:
1153258733589.57
Hear is my solution:
65.3-1+52*7602.31*(783.32+34.2*86.4*987.01-863.4/653.9)+8.3*6.5/2.4+935.32+(64.37/96.34*68.2+4.87/5.89*364.6)+345.67/862.54*753.59+239.32/9
and even with that request to have at least two decimal places in the answer PHP instead shoots out the result:
PHP-given answer: 1.15325873359E+012
How exactly did you force PHP to show the number with two decimal places since the above function call actually forces it into scientific notation? Thanks.
Is there no limit for the answer?
0) Isn't it supposed to be in range 0.00-9999.99 ?
Also:
1) How would be (1/9999)*9999 calculated?
Is it 1.00 or (you said about about rounding the numbers after each operation) 0.00 (1/9999 = 0.00..., 0*9999 = 0)
2) What is the memory limit?
Must read Review for Serious PHP Developers
NuSphere PhpED 5.5
: The Staff of php-editors.com recently spent a few days working with NuSphere
PhpED 5.5
(a popular PHP IDE) and
NuCoder 2.0
(a PHP Encoding Utility), read up on all the details.