困惑如何在C中实现数学

时间:2014-04-18 11:44:29

标签: c math puzzle

我想制作一个可以解决下面给出的数学问题的C程序,但我无法做到。如果有人能做到,我会非常感激吗? 一位农民有81头奶牛,编号为1到81.没有1头牛给1公斤牛奶......没有2给2公斤......没有81给每天81公斤。农民有9个儿子。现在他想把他的奶牛分布在他的儿子身上,这样每个儿子都可以吃掉9头奶牛和奶牛。牛奶总量会相同。他怎么分发?

1 个答案:

答案 0 :(得分:1)

涉及的数学不多。更像是对收藏品的操纵。

将81头奶牛分成9个不断增加的奶牛。

[ 1,  2,  3,  4,  5,  6,  7,  8,  9]
[10, 11, 12, 13, 14, 15, 16, 17, 18]
[19, 20, 21, 22, 23, 24, 25, 26, 27]
[28, 29, 30, 31, 32, 33, 34, 35, 36]
[37, 38, 39, 40, 41, 42, 43, 44, 45]
[46, 47, 48, 49, 50, 51, 52, 53, 54]
[55, 56, 57, 58, 59, 60, 61, 62, 63]
[64, 65, 66, 67, 68, 69, 70, 71, 72]
[73, 74, 75, 76, 77, 78, 79, 80, 81]

将每个批次的内容左移一个以上的内容。

[ 1,  2,  3,  4,  5,  6,  7,  8,  9]
[11, 12, 13, 14, 15, 16, 17, 18, 10]
[21, 22, 23, 24, 25, 26, 27, 19, 20]
[31, 32, 33, 34, 35, 36, 28, 29, 30]
[41, 42, 43, 44, 45, 37, 38, 39, 40]
[51, 52, 53, 54, 46, 47, 48, 49, 50]
[61, 62, 63, 55, 56, 57, 58, 59, 60]
[71, 72, 64, 65, 66, 67, 68, 69, 70]
[81, 73, 74, 75, 76, 77, 78, 79, 80]

每个儿子选择一个专栏,然后选择所有这些奶牛。

son #1 gets [ 1, 11, 21, 31, 41, 51, 61, 71, 81], for a total of 369.
son #2 gets [ 2, 12, 22, 32, 42, 52, 62, 72, 73], for a total of 369.
son #3 gets [ 3, 13, 23, 33, 43, 53, 63, 64, 74], for a total of 369.
son #4 gets [ 4, 14, 24, 34, 44, 54, 55, 65, 75], for a total of 369.
son #5 gets [ 5, 15, 25, 35, 45, 46, 56, 66, 76], for a total of 369.
son #6 gets [ 6, 16, 26, 36, 37, 47, 57, 67, 77], for a total of 369.
son #7 gets [ 7, 17, 27, 28, 38, 48, 58, 68, 78], for a total of 369.
son #8 gets [ 8, 18, 19, 29, 39, 49, 59, 69, 79], for a total of 369.
son #9 gets [ 9, 10, 20, 30, 40, 50, 60, 70, 80], for a total of 369.

此方法似乎适用于任何数量的儿子,而不仅仅是9。