10312 - Expression Bracketing
Moderator: Board moderators
10312 - Expression Bracketing
No definition of non-binary bracketing was given.
please clarify, thanks.
bolster
please clarify, thanks.
bolster
here is definition, but it's a spoiler too:
http://mathworld.wolfram.com/BinaryBracketing.html
(my short definition was wrong)
http://mathworld.wolfram.com/BinaryBracketing.html
(my short definition was wrong)
Last edited by Picard on Tue Jul 02, 2002 6:57 pm, edited 1 time in total.
-
- New poster
- Posts: 3
- Joined: Wed Apr 17, 2002 1:26 pm
Better definition: "the number of different ways in which a product of n different ordered factors can be calculated by pairs"Picard wrote:here is definition, but it's a spoiler too:
http://mathworld.wolfram.com/BinaryBracketing.html
in short: binary bracketing when maximum two 'x' stand next to each other. non-binary when it's not binary, so there is somewhere a 'xxx'.
To author of the task:
Dear Shahriar, please, next time include the definition of the terms and don't make people surf the internet, since they would better spend this time to problem solving.
Best regards,
Ihor Bobak.
a binary operation is one that accepts two arguments as input.
so +,-,*,/ are all binary operators. A binary bracketing is a bracketing
such that all operations are binary.
think of the x's as arguments to an operator. if we have xxxx, then
the operator is getting 4 arguments. however, if we put brackets like
this: (xx)(xx) then (xx) is binary (it accepts 2 arugments) and (xx)(xx) is binary since it recieves
two arugments, namely two (xx)'s. so (xx)(xx) is a binary bracketing.
some more examples: ((xx)x)x. this is binary since (xx) is binary, and
if we replace (xx) with y, then we have (yx)x. (yx) is obviously binary so replace it with z and we end up with zx. Thus, the whole thing is
a binary bracketing.
((xx)xx)x is NOT binary. To see this, let y=(xx). then we have (yxx)x, and yxx is not binary because it accepts 3 arguments.
There's a well known formula for calculating how many ways
(n+1) terms can be binary bracketed, which makes this problem a piece
of cake.
I hope this clears it up.
Broderick
so +,-,*,/ are all binary operators. A binary bracketing is a bracketing
such that all operations are binary.
think of the x's as arguments to an operator. if we have xxxx, then
the operator is getting 4 arguments. however, if we put brackets like
this: (xx)(xx) then (xx) is binary (it accepts 2 arugments) and (xx)(xx) is binary since it recieves
two arugments, namely two (xx)'s. so (xx)(xx) is a binary bracketing.
some more examples: ((xx)x)x. this is binary since (xx) is binary, and
if we replace (xx) with y, then we have (yx)x. (yx) is obviously binary so replace it with z and we end up with zx. Thus, the whole thing is
a binary bracketing.
((xx)xx)x is NOT binary. To see this, let y=(xx). then we have (yxx)x, and yxx is not binary because it accepts 3 arguments.
There's a well known formula for calculating how many ways
(n+1) terms can be binary bracketed, which makes this problem a piece
of cake.
I hope this clears it up.
Broderick
-
- New poster
- Posts: 3
- Joined: Thu Oct 31, 2002 5:10 am
- Location: mexico
- Contact:
10312
please help me. i'm having WA
and i dont know if is beacuse of the data type im using. with a long long i got 42624971294485657 as output with 26 as input. is this right?
other with input 24 give 1416118615851221 with a double and 1416461675464871 with a long long.
thanks
[/cpp]

other with input 24 give 1416118615851221 with a double and 1416461675464871 with a long long.
thanks
[/cpp]
-
- New poster
- Posts: 3
- Joined: Thu Oct 31, 2002 5:10 am
- Location: mexico
- Contact:
-
- New poster
- Posts: 3
- Joined: Thu Oct 31, 2002 5:10 am
- Location: mexico
- Contact:
Well...It is a solution, but you can't find the numbers on your own, so at the end you still need to write a program 
I don't want to post all output here, because everyone may simply get AC by hardcoding.
As mentioned before, the output to 24 is 1416118615851221. If you get this correct, you should have the correct formula.

I don't want to post all output here, because everyone may simply get AC by hardcoding.
As mentioned before, the output to 24 is 1416118615851221. If you get this correct, you should have the correct formula.
confused
i also got WA several times and don't know why till now
my program for the input
24
25
26
is the following:
1416118615851221
7759443920290221
42620109348084205
am i right?
thx in advance

my program for the input
24
25
26
is the following:
1416118615851221
7759443920290221
42620109348084205
am i right?
thx in advance
-
- System administrator & Problemsetter
- Posts: 399
- Joined: Sat Jan 12, 2002 2:00 am
Hmm
I thought example is the best form of definition. So I used example in my problem. Now I find that some people things the other way. Well! I cannot please everyone. For example if I give the definition of complete graph in my problem! An expert in graph theory will feel annoyed and vice versa for a novice in the same topic.