[求助]这个能否用c程序解决?
刚看到这个推理题不知道能否用c程序解决呢?
A teacher says: I'm thinking of two natural numbers bigger than 1. Try to guess what they are.
The first student knows their product(乘积) and the other one knows their sum.
First: I do not know the sum.
Second: I knew that. The sum is less than 14.
First: I knew that. However, now I know the numbers.
Second: And so do I.
What were the numbers?
----------------解决方案--------------------------------------------------------
用穷举法也可以求吧,
从1到11里面求出所有任意两个(之和小于14的)数的可能乘积(并记录每个乘积的访问次数以及由那些数相乘而得),
从乘积列表里面找出访问次数为 1 的(我想应该只有一个吧)就是那个解。
----------------解决方案--------------------------------------------------------
记得有个关于生日的题目,问法差不多
本论坛的老帖,和本帖不一样
----------------解决方案--------------------------------------------------------
2,6
----------------解决方案--------------------------------------------------------