都说程序员逻辑思维强,高手帮解答下

wangcaidpjxwq 2010-07-15 03:44:08
1)有3个人去投宿,
一晚30元.
三个人每人掏了10元凑够30元交给了老板.
后来老板说今天优惠只要25元就够了,
拿出5元命令服务生退还给他们,
服务生偷偷藏起了2元,
然后,
把剩下的3元钱分给了那三个人,
每人分到1元.
这样,
一开始每人掏了10元,
现在又退回1元,
也就是10-1=9,
每人只花了9元钱,
3个人每人9元,
3 X 9 = 27元 + 服务生藏起的2元=29元,
还有一元钱去了哪里???
此题在新西兰面试的时候曾引起巨大反响.
有谁知道答案呢?
(2).有个人去买葱
问葱多少钱一斤
卖葱的人说 1块钱1斤 这是100斤 要完100元
买葱的人又问 葱白跟葱绿分开卖不
卖葱的人说 卖 葱白7毛 葱绿3毛
买葱的人都买下了
称了称葱白50斤 葱绿50斤
最后一算葱白50*7等于35元
葱绿50*3等于15元
35+15等于50元
买葱的人给了卖葱的人50元就走了
而卖葱的人却纳闷了
为什么明明要卖100元的葱
而那个买葱的人为什么50元就买走了呢?
你说这是为什么?
好好想想 把答案留下
(3).有口井 7米深
有个蜗牛从井底往上爬
白天爬3米 晚上往下坠2米
问蜗牛几天能从井里爬出来?
想好答案留言
(4).一毛钱一个桃
三个桃胡换一个桃
你拿1块钱能吃几个桃?
想明白了留言,把你吃桃的方法写明白 ~

(5)有十二个乒乓球形状、大小相同,其中只有一个重量与其它十一个不同,现在要求用一部没有砝码的天秤称三次,将那个重量异常的球找出来,并且知道它比其它十一个球较重还是较轻。
(6)一个商人骑一头驴要穿越1000公里长的沙漠,去卖3000根胡萝卜。已知驴一次性可驮1000根胡萝卜,但每走1公里又要吃掉1根胡萝卜。问:商人最多可卖出多少胡萝卜?

(7)话说某天一艘海盗船被天下砸下来的一头牛给击中了,5个倒霉的家伙只好逃难到一个孤岛,发现岛上孤零零的,幸好有有棵椰子树,还有一只猴子!大家把椰子全部采摘下来放在一起,但是天已经很晚了,所以就睡觉先.

晚上某个家伙悄悄的起床,悄悄的将椰子分成5份,结果发现多一个椰子,顺手就给了幸运的猴子,然后又悄悄的藏了一份,然后把剩下的椰子混在一起放回原处,最后还是悄悄滴回去睡觉了.

过了会儿,另一个家伙也悄悄的起床,悄悄的将剩下的椰子分成5份,结果发现多一个椰子,顺手就又给了幸运的猴子,然后又悄悄滴藏了一份,把剩下的椰子混在一起放回原处,最后还是悄悄滴回去睡觉了.

又过了一会 ......

又过了一会 ...

总之5个家伙都起床过,都做了一样的事情。早上大家都起床,各自心怀鬼胎的分椰子了,这个猴子还真不是一般的幸运,因为这次把椰子分成5分后居然还是多一个椰子,只好又给它了.问题来了,这堆椰子最少有多少个?

(8)某个岛上有座宝藏,你看到大中小三个岛民,你知道大岛民知道宝藏在山上还是山下,但他有时说真话有时说假话,只有中岛民知道大岛民是在说真话还是说假话,但中岛民自己在前个人说真话的时候才说真话,前个人说假话的时候就说假话,这两个岛民用举左或右手的方式表示是否,但你不知道哪只手表示是,哪只手表示否,只有小岛民知道中岛民说的是真还是假,他用语言表达是否,他也知道左右手表达的意思。但他永远说真话或永远说假话,你也不知道他是这两种类型的哪一种,你能否用最少的问题问出宝藏在山上还是山下?(提示:如果你问小岛民宝藏在哪,他会反问你怎么才能知道宝藏在哪?等于白问一句)


(9)说一个屋里有多个桌子,有多个人?

如果3个人一桌,多2个人。

如果5个人一桌,多4个人。

如果7个人一桌,多6个人。

如果9个人一桌,多8个人。

如果11个人一桌,正好。

请问这屋里多少人

(10)有人想买几套餐具,到餐具店看了后,发现自己带的钱可以买21把叉子和21把勺子,或者28把小刀。如果他买的叉子,勺子,小刀数量不统一,就无法配成套,所以他必须买同样多的叉子,勺子,小刀,并且正好将身上的钱用完。如果你是这个人,你该怎么办?
(11)一个小偷被警查发现
警查就追小偷,小偷就跑
跑着着跑着,前面出现条河
这河宽12米,河在小偷和警查这面有颗树
树高12米,树上叶子都光了
小偷围着个围脖长6米
问小偷如何过河跑????
...全文
2532 61 打赏 收藏 转发到动态 举报
写回复
用AI写文章
61 条回复
切换为时间正序
请发表友善的回复…
发表回复
冰岛男孩 2010-07-22
  • 打赏
  • 举报
回复
只会做几道题
lunar0000 2010-07-19
  • 打赏
  • 举报
回复
第一题中的3*9+2没有啥意义,一共是30块钱,有25在老板手中.两块在报务员手中,还有3块在3 个人的手中.
第二题是人家就买了50斤的葱就50块钱了.
第三题是5天.((7-3)/(3-2))+1
第四题是14个桃.10+10/3+10/3/3.
第五题:
先把12个球分成甲、乙两组.每组各6个.
第一次试验:
分别测试甲、乙两组。每个托盘中各放3个球。若在测试甲时,两个托盘平衡,则问题球在乙中。
第二次测试:
若问题球在乙中,此时可以根据天平的倾斜得出两边的球重的关系。则分别从放有球的两个托盘中(每个托盘现在有3个球),各取出一个球,若还平衡说明问题球在我们取出的那两上球中。第三次测试0
若天平的平衡还是不平衡说明问题球就在天平中。(些天平中有四个球)。此时进行第三次测试1.
第三次测试0:
将我们刚刚取了的两个球(两个问题球),任意取一个,和其它球相比,若正常说明另一个球有问题。再根据测试二中得出的重量关系得出出问题的那个球是重了还是轻了。
第三次测试1:
将两个托盘中的任意一人托盘中的球拿出来。(此时只有一个托盘中有球:2个)。再将这两个球分别放个两个托盘中,可以得出两个球的重量关系。再根据测试2中的倾斜就可以得出两个球的重量情况。


aemyang1987 2010-07-19
  • 打赏
  • 举报
回复
只会做几道题
ldzsl 2010-07-19
  • 打赏
  • 举报
回复
每天回帖即可获得10分可用分
gxd305 2010-07-19
  • 打赏
  • 举报
回复
1. 这个问题 不回答了
2. 上面也有正解,相当于 2斤1块钱了
3. 第四天爬到 3 + 3 = 6 不到 7呢, 所以应该是 第5天 4 + 3 = 7
4. 楼上有正解,不过那个借,我还真没有想到。 15个
5. 不知道
6. 5x + 3y + z = 3000 - n
x + y + z = 1000
4x + 2y = 2000 - n

楼上有解,但是没有搞明白。
7.
开始为 y个
则有
(y - 1) * 4/5 = 4y/5 - 4/5
(4y/5 - 4/5 - 1) * 4/5 = 16y/25 - 36/25 = 16y/25 - ( 1+ 4/5) * 4/5 = 4/5^2 * y - ( 4/5 + 4/5^2)
(4/5^2 * y - (4/5 + 4/5^2) - 1 ) * 4/5 = 4/5 ^ 3 * y - (4/5 + 4/5 ^2 + 4/5 ^3)
最后一次分的时候就是 4/5 ^ 6 * y - (4/5( 1- 4/5^6) / (1/5) = 4/5 ^ 6 * y - 4 * ( 1 - 4/5 ^6)
= 4/5 ^ 6 * ( y + 4) - 4 = 4096/15625 * ( y +4) - 4

所以 y + 4 = 15625, y = 15621
8. 不知道
9. 315 = 28 * 11 + 7
7x = 11y + 1
7 * 8 = 11 * 5 + 1

所以 315 * 8 - 1 = 2519
10. 21x + 21y = 28z
n(x+y+z) = 21x + 21y = 28z
n(k+z) = 21k = 28z

so k = 28m, z = 21m
so 49mn = 21*28m
so n = 12
11,不知道。
kamanyang 2010-07-18
  • 打赏
  • 举报
回复
顶一下。。。。。。。
f493382910 2010-07-18
  • 打赏
  • 举报
回复
会的楼上答过了, 留个脚印
gxd305 2010-07-18
  • 打赏
  • 举报
回复
[Quote=引用 55 楼 hertz2007 的回复:]

(9)说一个屋里有多个桌子,有多个人?

如果3个人一桌,多2个人。

如果5个人一桌,多4个人。

如果7个人一桌,多6个人。

如果9个人一桌,多8个人。

如果11个人一桌,正好。

请问这屋里多少人


1. 先求3,5,7,9最小公倍数-1,为314.
2. 再求3,5,7,9,11最小公倍数,为10395.
3. 求A = 314 +……
[/Quote]

这位的,
3. 求A = 314 + n * 10395,A为能被11整除的最小整数,n = 0, 1, 2,...
因为 314 不能被11整除,而10395可以被11整除,那么 A 怎么可能被11整除呢?

应该这样的,
314没有问题, 315 = 28 * 11 + 7
7x = 11y + 1
7 * 8 = 11 * 5 + 1

所以 315 * 8 - 1 = 2519
z365days 2010-07-18
  • 打赏
  • 举报
回复
对于这些问题的解答,关键是要看如何去思考,用什么样的方法去解决一类的问题,而那一个题目的结果本身并不是那么重要。这对于程序员来说,尤其如此。

比如第一道题,就可以用状态转移法进行解决。顾客、老板、小二三个角色,在不同的时刻,他们手里的钱是不一样的,也就是状态不同。通过观察状态转移,就可以得出正确的结论。

看到前面诸多回答,感觉好象不是程序员们回答的。
hertz2007 2010-07-18
  • 打赏
  • 举报
回复
(9)说一个屋里有多个桌子,有多个人?

如果3个人一桌,多2个人。

如果5个人一桌,多4个人。

如果7个人一桌,多6个人。

如果9个人一桌,多8个人。

如果11个人一桌,正好。

请问这屋里多少人


1. 先求3,5,7,9最小公倍数-1,为314.
2. 再求3,5,7,9,11最小公倍数,为10395.
3. 求A = 314 + n * 10395,A为能被11整除的最小整数,n = 0, 1, 2,...
4. 以A为基底,则 B = A + m * 10395 为所求, m = 0, 1, 2,...
qq413187589 2010-07-17
  • 打赏
  • 举报
回复
说一个屋里有多个桌子,有多个人?
如果3个人一桌,多2个人。
如果5个人一桌,多4个人。
如果7个人一桌,多6个人。
如果9个人一桌,多8个人。
如果11个人一桌,正好。
请问这屋里多少人


这题有问题吧!
根本就无解!


this is ture value 2519
this is ture value 5984
this is ture value 9449
this is ture value 12914
this is ture value 16379
this is ture value 19844
this is ture value 23309
this is ture value 26774
this is ture value 30239
this is ture value 33704
this is ture value 37169
this is ture value 40634
this is ture value 44099
this is ture value 47564
this is ture value 51029
this is ture value 54494
this is ture value 57959
this is ture value 61424
this is ture value 64889
this is ture value 68354
this is ture value 71819
this is ture value 75284
this is ture value 78749
this is ture value 82214
this is ture value 85679
this is ture value 89144
this is ture value 92609
this is ture value 96074
this is ture value 99539
this is ture value 103004
this is ture value 106469
this is ture value 109934
this is ture value 113399
this is ture value 116864
this is ture value 120329
this is ture value 123794
this is ture value 127259
this is ture value 130724
this is ture value 134189
this is ture value 137654
this is ture value 141119
this is ture value 144584
this is ture value 148049
this is ture value 151514
this is ture value 154979
this is ture value 158444
this is ture value 161909
this is ture value 165374
this is ture value 168839
this is ture value 172304
this is ture value 175769
this is ture value 179234
this is ture value 182699
this is ture value 186164
this is ture value 189629
this is ture value 193094
this is ture value 196559
this is ture value 200024
this is ture value 203489
this is ture value 206954
this is ture value 210419
this is ture value 213884
this is ture value 217349
this is ture value 220814
this is ture value 224279
this is ture value 227744
this is ture value 231209
this is ture value 234674
this is ture value 238139
this is ture value 241604
this is ture value 245069
this is ture value 248534
this is ture value 251999
this is ture value 255464
this is ture value 258929
this is ture value 262394
this is ture value 265859
this is ture value 269324
this is ture value 272789
this is ture value 276254
this is ture value 279719
this is ture value 283184
this is ture value 286649
this is ture value 290114
this is ture value 293579
this is ture value 297044
this is ture value 300509
this is ture value 303974
this is ture value 307439
this is ture value 310904
this is ture value 314369
this is ture value 317834
this is ture value 321299
this is ture value 324764
this is ture value 328229
this is ture value 331694
this is ture value 335159
this is ture value 338624
this is ture value 342089
this is ture value 345554
this is ture value 349019
this is ture value 352484
this is ture value 355949
this is ture value 359414
this is ture value 362879
this is ture value 366344
this is ture value 369809
this is ture value 373274
this is ture value 376739
this is ture value 380204
this is ture value 383669
this is ture value 387134
this is ture value 390599
this is ture value 394064
this is ture value 397529
this is ture value 400994
this is ture value 404459
this is ture value 407924
this is ture value 411389
this is ture value 414854
this is ture value 418319
this is ture value 421784
this is ture value 425249
this is ture value 428714
this is ture value 432179
this is ture value 435644
this is ture value 439109
this is ture value 442574
this is ture value 446039
this is ture value 449504
this is ture value 452969
this is ture value 456434
this is ture value 459899
this is ture value 463364
this is ture value 466829
this is ture value 470294
this is ture value 473759
this is ture value 477224
this is ture value 480689
this is ture value 484154
this is ture value 487619
this is ture value 491084
this is ture value 494549
this is ture value 498014
this is ture value 501479
this is ture value 504944
this is ture value 508409
this is ture value 511874
this is ture value 515339
this is ture value 518804
this is ture value 522269
this is ture value 525734
this is ture value 529199
this is ture value 532664
this is ture value 536129
this is ture value 539594
this is ture value 543059
this is ture value 546524
this is ture value 549989
this is ture value 553454
this is ture value 556919
this is ture value 560384
this is ture value 563849
this is ture value 567314
this is ture value 570779
this is ture value 574244
this is ture value 577709
this is ture value 581174
this is ture value 584639
this is ture value 588104
this is ture value 591569
this is ture value 595034
this is ture value 598499
this is ture value 601964
this is ture value 605429
this is ture value 608894
this is ture value 612359
this is ture value 615824
this is ture value 619289
this is ture value 622754
this is ture value 626219
this is ture value 629684
this is ture value 633149
this is ture value 636614
this is ture value 640079
this is ture value 643544
this is ture value 647009
this is ture value 650474
this is ture value 653939
this is ture value 657404
this is ture value 660869
this is ture value 664334
this is ture value 667799
this is ture value 671264
this is ture value 674729
this is ture value 678194
this is ture value 681659
this is ture value 685124
this is ture value 688589
this is ture value 692054
this is ture value 695519
this is ture value 698984
this is ture value 702449
this is ture value 705914
this is ture value 709379
this is ture value 712844
this is ture value 716309
this is ture value 719774
this is ture value 723239
this is ture value 726704
this is ture value 730169
this is ture value 733634
this is ture value 737099
this is ture value 740564
this is ture value 744029
this is ture value 747494
this is ture value 750959
this is ture value 754424
this is ture value 757889
this is ture value 761354
this is ture value 764819
this is ture value 768284
this is ture value 771749
this is ture value 775214
this is ture value 778679
this is ture value 782144
this is ture value 785609
this is ture value 789074
this is ture value 792539
this is ture value 796004
this is ture value 799469
this is ture value 802934
this is ture value 806399
this is ture value 809864
this is ture value 813329
this is ture value 816794
this is ture value 820259
this is ture value 823724
this is ture value 827189
this is ture value 830654
this is ture value 834119
this is ture value 837584
this is ture value 841049
this is ture value 844514
this is ture value 847979
this is ture value 851444
this is ture value 854909
this is ture value 858374
this is ture value 861839
this is ture value 865304
this is ture value 868769
this is ture value 872234
this is ture value 875699
this is ture value 879164
this is ture value 882629
this is ture value 886094
this is ture value 889559
this is ture value 893024
this is ture value 896489
this is ture value 899954
this is ture value 903419
this is ture value 906884
this is ture value 910349
this is ture value 913814
this is ture value 917279
this is ture value 920744
this is ture value 924209
this is ture value 927674
this is ture value 931139
this is ture value 934604
this is ture value 938069
this is ture value 941534
this is ture value 944999
this is ture value 948464
this is ture value 951929
this is ture value 955394
this is ture value 958859
this is ture value 962324
this is ture value 965789
this is ture value 969254
this is ture value 972719
this is ture value 976184
this is ture value 979649
this is ture value 983114
this is ture value 986579
this is ture value 990044
this is ture value 993509
this is ture value 996974
this is ture value 1000439
this is ture value 1003904
this is ture value 1007369
this is ture value 1010834
this is ture value 1014299
this is ture value 1017764
this is ture value 1021229
......




gammaring1016 2010-07-17
  • 打赏
  • 举报
回复
其实,如果你把 这个三个人看大款,一切费用他们承担,反正他们用了27元,剩下的就是老板和员工分,
27=2+25,如果用3x9=27,里面已经包括了本次消费的开支包括员工的2元,所以不能用3x9+2,记住大款不是,那个老板,而是这三个家伙
gammaring1016 2010-07-17
  • 打赏
  • 举报
回复
钱,在老板身上
wanglianfeng0206 2010-07-17
  • 打赏
  • 举报
回复
十一题: 树没叶子,他还带围脖,说明是冬天,所以是从冰上跑过去的
lgzh2010 2010-07-17
  • 打赏
  • 举报
回复
bucuo-bucuo
宇峰科技 2010-07-17
  • 打赏
  • 举报
回复
分一半称就OK了,6、6 ,3、3,1、1知道了吗[Quote=引用 7 楼 hihitang 的回复:]
第五题我在学校做过 整个判定思路比较复杂 一下子记不起来了
[/Quote]
goneswing 2010-07-17
  • 打赏
  • 举报
回复
第3题应该是4天.第四天的时候爬到7米了不用再往下掉了
z2665 2010-07-17
  • 打赏
  • 举报
回复
第一题很简单。。只要把服务员的钱看作为回到老板手中的钱就可以了
第二题相当于乘法原则来说是不能分开算的
shaohui973 2010-07-17
  • 打赏
  • 举报
回复

#include<iostream>
using namespce std;
int main()
{
int total,a,t;
cin>>a>>endl;
total=a;
while(a/3)
{
t=a/3;
a=t+a%3;
total+=t;
}
cout<<total<<endl;
return 0;
}
吃桃子问题
beingshadow 2010-07-17
  • 打赏
  • 举报
回复
第4题:先买10个桃,吃了,得10个核,然后换3个桃吃了,这时剩4个核,然后换1个桃,吃了,这时剩2核,然后接1个核,凑够数,再换1个桃,吃掉,把核还了。这样就能吃15个了。
第5题:平均分成2组,称出来有一组是重的,记为A(有6个球,其中一个是要找的),然后将A平均分成两组,称出来中的记为B(有3个球,其中一个是要找的),然后从B中随便拿俩,记为C,D,剩下没称的,记为E;如果CD一样重,则E为要找的,否则,称出来哪个重,哪个就是要找的。
第6题:在2000~3000个胡萝卜的时候,没走1公里,消耗5个萝卜(2个半来回),这样,1000/5=200,当还剩800(1000-200)的时候,还剩2000个萝卜;在1000到2000个萝卜的时候,每走1公里,消耗3个萝卜(1个半来回),这样1000/3=333...1,当还剩467(800-333)的时候,还剩1001个萝卜,再走1公里,(注意,此处单独走了一下:) )这时,驴子驮着999个萝卜,还剩466公里(467-1);然后就赶着毛驴往前走吧,不回头了(虽然在距到达467公里的时候还留在1个胡萝卜),这样,到站的时候,就剩533个萝卜了(999-466)。
加载更多回复(40)

110,538

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧