Older Contests
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Codewalkers ForumsPHP ContestsOlder Contests

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Codewalkers Forums Sponsor:
  #1  
Old October 14th, 2003, 03:54 PM
Matt Matt is offline
Contributing User
Codewalkers Specialist (4000 - 4499 posts)
 
Join Date: Apr 2007
Location: Florida
Posts: 4,158 Matt User rank is Private First Class (20 - 50 Reputation Level)Matt User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 4 h 10 m 20 sec
Reputation Power: 6
[numbers] Solution Clarification thread

OK...we are going to try this again. I am posting my last message from the previous thread next. Some rules of this new thread:

1. One issue at a time. If you need something clarified, don't post it until I have clarified the issue the person before you brought up. This might mean you have to wait a little while before posting what you need clarified. That's OK.

2. Don't post anything that doesn't deal with the topic at hand.

3. Let's try and make this as simple as possible. I really don't think it is all that hard...


Ok, next post is my post from last thread, modified slightly. Forget everything from the previous thread, it is gone.

Reply With Quote
  #2  
Old October 14th, 2003, 03:59 PM
Matt Matt is offline
Contributing User
Codewalkers Specialist (4000 - 4499 posts)
 
Join Date: Apr 2007
Location: Florida
Posts: 4,158 Matt User rank is Private First Class (20 - 50 Reputation Level)Matt User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 4 h 10 m 20 sec
Reputation Power: 6
[numbers] RE: Solution Clarification thread

You can use the 4 basic operators, + - / and *. That is a subtraction operator, not a negator. It can NOT be used as such:

-(5+6)+20=9

You can use parentheses, but they must be necessary. 3+(4+5) is NOT necessary use. It is the same as 3+4+5. Necessary use is (3+4)*5


OK, say you had this set:

10,20,30,40,50,60,120

All of the following ARE valid:

20+40+60=120
10+20+30+60=120
10+20+40+50=120
10*20-30-50=120
10*60/20+40+50=120
60/10*20=120
(60-50)*(40-30)+20=120


The following demonstrates duplicates, i.e. solutions that are NOT distinct and should only count as one solution.

20+40+60 and 60+40+20 - changing the order does not make a different solution.

60/10*20 and 20/10*60 - while this may look different, it is the same. Anytime you find a solution that is x/y*z, z/y*x always exists. No reason to have both, so this is a duplicate.

(60-50)*(40-30)+20 and (50-60)*(30-40)+20 - follows the same as last time. Once you find one, you always have the other.


Ok, first person that needs a clarification, step up.

Reply With Quote
  #3  
Old October 14th, 2003, 04:41 PM
xs0 xs0 is offline
Codewalkers Novice (500 - 999 posts)
 
Join Date: Apr 2007
Location: Ljubljana, Slovenia
Posts: 760 xs0 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
[numbers] RE: Solution Clarification thread

Well, how about this somewhat mathematical definition of duplicates:

Take the two expressions you're interested in.

If there's not the same amount of numbers in each, they're not duplicates (as in 2+3 and 2+3+4-4; first uses 2 numbers, second uses 4)

If they don't use the same numbers, they're also not duplicates (as in 2+3+4-4 and 2+3+5-5)

Then, define two functions by changing all numbers to letters, so that the same numbers match the same letters in both expressions. For example:

(60-50)*(40-30)+20
and
(50-60)*(30-40)+20

become

func1(a,b,c,d,e):=(a-b)*(c-d)+e
func2(a,b,c,d,e):=(b-a)*(d-c)+e

Now, if func1(a,b,c,d,e)-func2(a,b,c,d,e)=0 for all values of a,b,c,d,e the two original expressions are considered duplicates. Use the same process for any number of parameters, not just 5, of course

Reply With Quote
  #4  
Old October 14th, 2003, 05:18 PM
Matt Matt is offline
Contributing User
Codewalkers Specialist (4000 - 4499 posts)
 
Join Date: Apr 2007
Location: Florida
Posts: 4,158 Matt User rank is Private First Class (20 - 50 Reputation Level)Matt User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 4 h 10 m 20 sec
Reputation Power: 6
[numbers] RE: Solution Clarification thread

OK....this sounds good...and somehow I knew you would be the first ;)

I've run through it on paper, and it seems solid. Let me post up a couple of examples so that everyone is on the same page...

20+40+60 and 60+40+20
f1 = a + b + c
f2 = c + b + a
f1 - f2 = a + b + c - c - b - a
f1 - f2 = 0

60/10*20 and 20/10*60
f1 = c/a*b
f2 = b/a*c
f1 - f2 = c/a*b - b/a*c = (cb)/a - (bc)/a
f1 - f2 = 0

(60-50)*(40-30)+20 and (50-60)*(30-40)+20
f1 = (a-b)*(c-d)+e
f2 = (b-a)*(d-c)+e
f1 - f2 = ac-ad-bc+bd+e-bd+bc+ad-ac-e
f1 - f2 = 0


So, here is our rule set...

1. If two solutions use a different amount of numbers, they are different.
2. If two solutions use different numbers, they are different.
3. if f1()-f2() <> 0 then they are different.


I'm glad we got a smart one like xs0 around here

Any more clarifications?

Reply With Quote
  #5  
Old October 14th, 2003, 06:35 PM
Anonymous Anonymous is offline
Registered User
Codewalkers God 35th Plane (22000 - 22499 posts)
 
Join Date: Apr 2007
Posts: 22,309 Anonymous User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 24
[numbers] RE: Solution Clarification thread

Will the given number/result sets all be solveable or is there the possibility of impossible to solve combinations?

for example:
numbers(1,2,3,4,5,6)
result(999)

will the numbers all be different, or is there the possibility of a number being used multiple times in one set?

for example:
numbers(1,2,1,4,5,6)

Reply With Quote
  #6  
Old October 14th, 2003, 07:22 PM
Matt Matt is offline
Contributing User
Codewalkers Specialist (4000 - 4499 posts)
 
Join Date: Apr 2007
Location: Florida
Posts: 4,158 Matt User rank is Private First Class (20 - 50 Reputation Level)Matt User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 4 h 10 m 20 sec
Reputation Power: 6
[numbers] RE: RE: Solution Clarification thread


Quote:
Will the given number/result sets all be solveable or is there the possibility of impossible to solve combinations?


The sets may be impossible.

Quote:
will the numbers all be different, or is there the possibility of a number being used multiple times in one set?


There may be duplicate numbers in a set.

Next?

Reply With Quote
  #7  
Old October 14th, 2003, 10:04 PM
mroch mroch is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 6 mroch User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
[numbers] RE: RE: Solution Clarification thread


Quote:
(60-50)*(40-30)+20 and (50-60)*(30-40)+20
f1 = (a-b)*(c-d)+e
f2 = (b-a)*(d-c)+e
f1 - f2 = ac-ad-bc+bd+e-bd+bc+ad-ac-e
f1 - f2 = 0

So, here is our rule set...

1. If two solutions use a different amount of numbers, they are different.
2. If two solutions use different numbers, they are different.
3. if f1()-f2() <> 0 then they are different.


(60-50)*(40-30)+20 = 120
30*20/(50-40)+60 = 120

f1 - f2
= (60-50)*(40-30)+20 - 30*20/(50-40)+60
= 10*10+20 - 600/10+60
= 120 - 120
= 0

Any two valid solutions should equal 0 when subtracted. Perhaps you mean that the simplified versions of both equations are the same?

Reply With Quote
  #8  
Old October 14th, 2003, 11:12 PM
Matt Matt is offline
Contributing User
Codewalkers Specialist (4000 - 4499 posts)
 
Join Date: Apr 2007
Location: Florida
Posts: 4,158 Matt User rank is Private First Class (20 - 50 Reputation Level)Matt User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 4 h 10 m 20 sec
Reputation Power: 6
[numbers] RE: Solution Clarification thread

(60-50)*(40-30)+20 and 30*20/(50-40)+60
f1 = (a-b)*(c-d)+e
f2 = d*e/(b-c)+a
f1 - f2 = ((a-b)*(c-d)+e) - (d*e/(b-c)+a)
f1 - f2 = (ac-ad-bc+bd+e) - (de/(b-c)+a)
f1 - f2 = ac-ad-bc+bd+e - de/(b-c)-a

Please continue to work that out until the right hand side of the equation is 0.


Reply With Quote
  #9  
Old October 14th, 2003, 11:18 PM
Anonymous Anonymous is offline
Registered User
Codewalkers God 35th Plane (22000 - 22499 posts)
 
Join Date: Apr 2007
Posts: 22,309 Anonymous User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 24
[numbers] Convet to variables first!


Quote:

(60-50)*(40-30)+20 = 120
30*20/(50-40)+60 = 120

f1 - f2
= (60-50)*(40-30)+20 - 30*20/(50-40)+60
= 10*10+20 - 600/10+60
= 120 - 120
= 0

Any two valid solutions should equal 0 when subtracted. Perhaps you mean that the simplified versions of both equations are the same?


Try converting to letters (variables).

( (a - b) * (c - d) + e ) - ( (d*e) / (b - c) ) + a

Not the same. The key point is that no matter what goes into the function, the values must be identical for func1 and func2. Try running this code and you'll see that different output is produced:
php Code:
Original - php Code
  1.  
  2. <?php
  3. function func1($a, $b, $c, $d, $e) {
  4. return (($a - $b) * ($c - $d) + $e);
  5. }
  6. function func2($a, $b, $c, $d, $e) {
  7. return ( ($d*$e) / ($b - $c)  ) + $a;
  8. }
  9.  
  10. echo func1(60, 50, 40, 30, 20)echo '<br>';
  11. echo func2(60, 50, 40, 30, 20)echo '<br>';
  12. echo '<br>';
  13. echo func1(100, 50, 40, 30, 20);   echo '<br>';
  14. echo func2(100, 50, 40, 30, 20);   echo '<br>';
  15. ?>


Reply With Quote
  #10  
Old October 15th, 2003, 12:10 AM
trube trube is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Honolulu, Hawaii
Posts: 7 trube User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
[numbers] RE: Solution Clarification thread

Is there any penalty for duplicates in the results, or will they just not be counted as points?

Reply With Quote
  #11  
Old October 15th, 2003, 12:13 AM
Matt Matt is offline
Contributing User
Codewalkers Specialist (4000 - 4499 posts)
 
Join Date: Apr 2007
Location: Florida
Posts: 4,158 Matt User rank is Private First Class (20 - 50 Reputation Level)Matt User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 4 h 10 m 20 sec
Reputation Power: 6
[numbers] RE: RE: Solution Clarification thread


Quote:
Is there any penalty for duplicates in the results, or will they just not be counted as points?


Your script will tell me, by way of its output, how many points it scored. If it reports an invalid score, it will be disqualified.

Reply With Quote
  #12  
Old October 15th, 2003, 03:33 AM
mroch mroch is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 6 mroch User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
[numbers] RE: RE: Solution Clarification thread

Quote:
You can use the 4 basic operators, + - / and *. That is a subtraction operator, not a negator. It can NOT be used as such:

-(5+6)+20=9


I don't think -(5+6)+20=9 should be illegal; it is just a duplicate of 20-5-6=9.

It's getting kind of late, so maybe I'm being stupid. Correct me if I'm wrong here...

Reply With Quote
  #13  
Old October 15th, 2003, 05:02 AM
dvorak dvorak is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 1 dvorak User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
[numbers] RE: Solution Clarification thread

<quote>
don't think -(5+6)+20=9 should be illegal; it is just a duplicate of 20-5-6=9.

It's getting kind of late, so maybe I'm being stupid. Correct me if I'm wrong here...
</quote>

Read the explanation about using functions with varaibles (instead of numbers) and you will see that the answer is staightforward.

Matt, you could provide a specific format in which you want the answers to be given. thus as results you will not have 20-5-6 and 20-6-5. Everybody sticks to the guidelines and i guess we come up with identical solutions (unless the solutions are wrong).

Suggestion - Each way of getting to a certain result must be canonized (as mentioned earlier in the contest description). The solution set for a given line (7 numbers) should be sorted (as string). Only the total number of ways is added to the out file, but when checkme=1 one should get a sorted result

This would make judging very simple

my 1 cent

dvorak

Reply With Quote
  #14  
Old October 15th, 2003, 09:12 AM
maxhb maxhb is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Bremen, Germany
Posts: 48 maxhb User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
[numbers] RE: RE: Solution Clarification thread

Hi!
Just a very simple example which shows me somethting is missing...
Set of numbers: 3,3,3,3,9
Quote:
Take the two expressions you're interested in.

1. 3*3*3/3
2. 3-3+3*3
Quote:
If there's not the same amount of numbers in each, they're not duplicates

Same amount of numbers --> may be duplicates...
Quote:
If they don't use the same numbers, they're also not duplicates

Same numbers used in both expressions --< may be duplicates

Quote:
Then, define two functions by changing all numbers to letters, so that the same numbers match the same letters in both expressions.

f1(a,b,c,d) = a*b*c/d
f2(a,b,c,d) = a-b+c*d

Quote:
Now, if func1(a,b,c,d,e)-func2(a,b,c,d,e)=0 for all values of a,b,c,d,e the two original expressions are considered duplicates.

Without further proof (hence all values are identical - clever bastard that I am) I claim that f1(a,b,c,d)-f2(a,b,c,d) euqals 0 for all possible values of a,b,c,d.

Is there anyone out there believing equation 1. and 2. should be considered as duplicates ;-)

CU
maxhb

Reply With Quote
  #15