IWETHEY v. 0.3.0 | TODO
1,095 registered users | 0 active users | 0 LpH | Statistics
Login | Create New User
IWETHEY Banner

Welcome to IWETHEY!

New May be I can see, after all :)
The way you handle binary '-' must be the key. This way, any use of unary minus can be expressed through binary one.
New Right
Here are two ways to see it.

The first is to note that if you apply unary - to an expression it can always be distributed into the expression. Either into the first term (case of * and /) or across both terms (+ and binary -). Therefore in any expression with unary -'s comes out to the same answer (after mechanical operations) as one where the only unary -'s are applied to individual terms. In other words you are building up expressions out of 9 and -9. But that just establishes the symmetry that I used to avoid having to consider negative numbers, so I ignore the -9.

The second is even slicker. You agree with the symmetry note? Then I only need to consider operations with non-negative numbers that come out to non-negative answers. Every expression involving 2 non-negative numbers comes out to something that is either on my list, or that is negative, or that gives the same value as something on my list.

In short, the unary - is useful because it establishes the symmetry. And once established, it turns out you never need to look at the unary -. (Actually it turns out to be a red herring. While the symmetry is relatively easily spotted, all you really need to know is that the set of negative values you can reach with n 9's is a subset of the set of negatives of positive values you can reach with n 9's.)

Cheers,
Ben
     Fun-looking stuff in Boston - (ben_tilly) - (18)
         Re: Fun-looking stuff in Boston - (Arkadiy) - (16)
             Nope, the correct answer has length 15 - (ben_tilly) - (15)
                 Oh shit! - (Arkadiy) - (14)
                     Heh - (ben_tilly) - (13)
                         OK, I know what you did. - (Arkadiy)
                         Fixed. - (Arkadiy) - (11)
                             I wouldn't count on that - (ben_tilly) - (10)
                                 Re: I wouldn't count on that - (Arkadiy)
                                 Big improvement! - (Arkadiy)
                                 Used STLport - (Arkadiy)
                                 STL + hash_map - (Arkadiy) - (6)
                                     See? I said that Perl was slow and bloated! - (ben_tilly) - (5)
                                         No luck on #2 - (Arkadiy) - (4)
                                             You can skip the - very easily - (ben_tilly) - (3)
                                                 That's the part I can't see - (Arkadiy) - (2)
                                                     May be I can see, after all :) - (Arkadiy) - (1)
                                                         Right - (ben_tilly)
         Certainly an interesting approach - (wharris2)

Sheer, unadultered, industrial-strength tinfoil-helmet alien-lizard-people drivel of the first degree.
48 ms