given a series of digits within {0,1,...,9} and operators to be taken in {+,-,*,/}. you can use () to change order arbitrarily. the ultimate goal is to form an equality between the left and right sides.
a few examples:
22 => 2=2
235 => 2+3=5
4221 => 4/(2+2)=1
rules:
1. there must be one and only one operator between two consecutive digits. so 4*6=24 is illegal.
2. there might be multiple some equalities, like 2221 => 2/2=2-1, 2-2/2=1. it's ok. as long as you can find one. still count as one.
so here comes the problem. given a 2-digit pair, of course there are only 10 such equalities. then what about 3-digit, 4-digit, 5-digit? and what about 100-digit? how many serials we can find such equalities?
just a problem for fun. anyone who sends the answer (with a reasonable logic other than brute force) will win a good gift.
thanks for playing.
没有评论:
发表评论