Sponsored by NuSphere - PHP Software for PHP Application Developers - On Sale This Week for $100



Go Back   PHP-Editors > Programming Contests > PHP Programming Contests

PHP Programming Contests Everything to do with the PHP Programming Contests.

Reply
 
LinkBack Thread Tools Display Modes
  #11 (permalink)  
Old 2004-04-21, 12:24 AM
Guest
Guest
 
Posts: n/a
Default

Do parenthesis count as operators? Or is it just the 4 + - / * ?
Reply With Quote
  #12 (permalink)  
Old 2004-04-21, 05:10 AM
stuart's Avatar
Administrator
 
Join Date: Jan 2003
Location: Scotland
Posts: 472
stuart will become famous soon enoughstuart will become famous soon enough
Send a message via MSN to stuart
Default

I will not count parenthesis as operators, only '+ - / *'.
Reply With Quote
  #13 (permalink)  
Old 2004-04-25, 09:29 AM
Guest
Guest
 
Posts: n/a
Default

Is there any range for answer to calculations, or you may give ANY resulting number, provided input numbers somehow evaluate to it?

i.e. sequence goes as x1,x2,x3,..,xn,R
the question is about range of R.

hope I make myself clear,
thanx
Reply With Quote
  #14 (permalink)  
Old 2004-04-28, 03:31 PM
Junior Member
 
Join Date: Apr 2004
Posts: 1
tekminar
Default

This challenge is giving me a headache lol.
Reply With Quote
  #15 (permalink)  
Old 2004-04-28, 10:28 PM
Junior Member
 
Join Date: Apr 2004
Posts: 1
srirangan
Default

Hello

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.

Thanks!
Srirangan
Reply With Quote
  #16 (permalink)  
Old 2004-04-29, 06:59 PM
Junior Member
 
Join Date: Apr 2004
Posts: 11
cristofv
Default

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...
Reply With Quote
  #17 (permalink)  
Old 2004-04-30, 04:34 AM
Junior Member
 
Join Date: Apr 2004
Posts: 6
quadra23
Default

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.
Reply With Quote
  #18 (permalink)  
Old 2004-04-30, 11:51 AM
stuart's Avatar
Administrator
 
Join Date: Jan 2003
Location: Scotland
Posts: 472
stuart will become famous soon enoughstuart will become famous soon enough
Send a message via MSN to stuart
Default

Hi,

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

I hope this helps a little!!
Reply With Quote
  #19 (permalink)  
Old 2004-05-01, 12:12 AM
Junior Member
 
Join Date: Apr 2004
Posts: 6
quadra23
Default

I tried running that solution that you gave in PHP under a variable definition such as:

$answer = round((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), 2);

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.
Reply With Quote
  #20 (permalink)  
Old 2004-05-01, 07:12 AM
Guest
Guest
 
Posts: n/a
Default

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?
Reply With Quote
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.

Sponsored Links
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -5. The time now is 11:59 PM.


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO 3.1.0
© Copyright 2003-2008 www.php-editors.com. The ultimate PHP Editor and PHP IDE site.