d*********1 发帖数: 25 | 1 has anybody come cross the following brainteaser?
sell X unit product:
2nd row , 1 left
3rd row , 1 left
.
.
.
10th row, 1 left
11th row, 0 left,
what is X? | r*******s 发帖数: 303 | 2 what are you talking about? | J**********g 发帖数: 213 | 3 I think what he means is that
we have x units for arrangement, if there are 2 units per row, then is one
unit left, 3 units per row, one unit left, 10 units per row, one unit left,
but 11 units per row, nothing left.
It's obvious x=121 works, but I don't think the answer is unique: we are
looking or an positive interger such that:
1=x mod 2
1=x mod 3
1=x mod 10
and 11 is a factor of x.
11 does not work, and 121 works, and we can keep testing. it's a solution if
and only if 11 divides x and 30 di | d*j 发帖数: 13780 | 4 最小公倍数, 呵呵
,
【在 J**********g 的大作中提到】 : I think what he means is that : we have x units for arrangement, if there are 2 units per row, then is one : unit left, 3 units per row, one unit left, 10 units per row, one unit left, : but 11 units per row, nothing left. : It's obvious x=121 works, but I don't think the answer is unique: we are : looking or an positive interger such that: : 1=x mod 2 : 1=x mod 3 : 1=x mod 10 : and 11 is a factor of x.
| k*******d 发帖数: 1340 | 5 if the problem is to find x s.t.
1=x mod 2
1=x mod 3
1=x mod 10
x=121 works, x = 61 also works. in fact , all x satisfying x = 1 mod 60
works...
It is Chinese Remainder Theorem. | J**********g 发帖数: 213 | 6 NO, 61 is not an answer since 11 does not divide 61...
Also it'd be a solution if and only if x=0 mod 11 and x=1 mod 30 instead of x=1 mod 60.
【在 k*******d 的大作中提到】 : if the problem is to find x s.t. : 1=x mod 2 : 1=x mod 3 : 1=x mod 10 : x=121 works, x = 61 also works. in fact , all x satisfying x = 1 mod 60 : works... : It is Chinese Remainder Theorem.
| p*****k 发帖数: 318 | 7 note 11 and 60 are co-prime, so the general solution is:
X = 121 (mod 660), or 660*m+121, where m is a non-negative integer.
but i think OP actually meant X modulo all numbers from 2 to 10
results 1, i.e., X=1(mod 2520) and X=0(mod 11).
again 11 and 2520 are coprime. by Euclidean algorithm,
the general solution is: X = 25201 (mod 27720) | k*******d 发帖数: 1340 | 8 Yes, you are right. Sorry I missed the last condition (x = 0 mod 11).
The general way to solve this problem is still CRT and Euclidean algo. But
how do you run Euclidean algo quickly during the interview?
【在 p*****k 的大作中提到】 : note 11 and 60 are co-prime, so the general solution is: : X = 121 (mod 660), or 660*m+121, where m is a non-negative integer. : but i think OP actually meant X modulo all numbers from 2 to 10 : results 1, i.e., X=1(mod 2520) and X=0(mod 11). : again 11 and 2520 are coprime. by Euclidean algorithm, : the general solution is: X = 25201 (mod 27720)
|
|