Java开发网 Java开发网
注册 | 登录 | 帮助 | 搜索 | 排行榜 | 发帖统计  

您没有登录

» Java开发网 » 灌水乐园  

按打印兼容模式打印这个话题 打印话题    把这个话题寄给朋友 寄给朋友    该主题的所有更新都将Email到你的邮箱 订阅主题
flat modethreaded modego to previous topicgo to next topicgo to back
作者 被人问了道题,才感觉数学忘的差不多了.....郁闷
cainiaosteven





发贴: 3
于 2004-11-04 15:00 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
题目:

在1到120之间,4 和 6 的倍数一共有几个?(不重复)

sigh....................................


cainiaosteven edited on 2004-11-04 15:06

作者 Re:被人问了道题,才感觉数学忘的差不多了.....郁闷 [Re:cainiaosteven]
dorrenchen





发贴: 298
于 2004-11-04 22:36 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
120/4 = 30,
120/6 = 20,
120 / 4 /6 = 5

30+20-5 = 45

total 45 numbers, if not include 4 and 6, then 43 numbers. is it?



作者 Re:被人问了道题,才感觉数学忘的差不多了.....郁闷 [Re:cainiaosteven]
fat32

一个字:帅!@_@

CJSDN高级会员


发贴: 251
于 2004-11-07 21:47 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
40


昨夜西风凋碧树,独上高楼,望尽天涯路。
衣带渐宽终不悔,为伊消得人憔悴。
众里寻他千百度,蓦然回首,那人却在灯火阑珊处。

作者 Re:被人问了道题,才感觉数学忘的差不多了.....郁闷 [Re:cainiaosteven]
emarket

亢龙有诲

CJSDN高级会员


发贴: 460
于 2004-11-07 23:47 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list

int commonMultipleCounter = 0;
for (int i = 1; i <= 120; i++) {
if ((i % 4 == 0) || (i % 6 == 0)) {
commonMultipleCounter++;
System.out.print(i + " ");
}
}
System.out.println("");
System.out.println(commonMultipleCounter);

结果:
4 6 8 12 16 18 20 24 28 30 32 36 40 42 44 48 52 54 56 60 64 66 68 72 76 78 80 84 88 90 92 96 100 102 104 108 112 114 116 120
40


emarket edited on 2004-11-07 23:55

个人Blog http://agilespeaking.blogspot.com/

作者 Re:被人问了道题,才感觉数学忘的差不多了.....郁闷 [Re:dorrenchen]
emarket

亢龙有诲

CJSDN高级会员


发贴: 460
于 2004-11-07 23:52 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
兄弟,
4 和 6 的公倍数(common multiple), 是他们的最小公倍数(least common multiple) 的倍数吧,
4和6的最大公约数(highest common factorr)是2, 所以,他们的最小公倍数 是 4*6/2=12,
所以从1-120, 4和6的公倍数 应该是 120/12 =10

dorrenchen wrote:
120/4 = 30,
120/6 = 20,
120 / 4 /6 = 5

30+20-5 = 45

total 45 numbers, if not include 4 and 6, then 43 numbers. is it?


emarket edited on 2004-11-08 00:01

个人Blog http://agilespeaking.blogspot.com/

作者 Re:被人问了道题,才感觉数学忘的差不多了.....郁闷 [Re:cainiaosteven]
emarket

亢龙有诲

CJSDN高级会员


发贴: 460
于 2004-11-08 00:03 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
4的倍数+6的倍数-4和6的公倍数:)
cainiaosteven wrote:
题目:

在1到120之间,4 和 6 的倍数一共有几个?(不重复)

sigh....................................



个人Blog http://agilespeaking.blogspot.com/

作者 Re:被人问了道题,才感觉数学忘的差不多了.....郁闷 [Re:cainiaosteven]
dorrenchen





发贴: 298
于 2004-11-08 03:37 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
tricky. thanks.


作者 Re:被人问了道题,才感觉数学忘的差不多了.....郁闷 [Re:cainiaosteven]
阿什





发贴: 9
于 2004-11-08 18:10 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
不错!


作者 Re:被人问了道题,才感觉数学忘的差不多了.....郁闷 [Re:cainiaosteven]
阿什





发贴: 9
于 2004-11-08 18:48 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
不错!


作者 Re:被人问了道题,才感觉数学忘的差不多了.....郁闷 [Re:cainiaosteven]
齐彬





发贴: 34
于 2004-11-10 16:30 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
刚刚发现一楼的问题,可是又发现大家都发现了,呵呵。



flat modethreaded modego to previous topicgo to next topicgo to back
  已读帖子
  新的帖子
  被删除的帖子
Jump to the top of page

   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱 714923@qq.com    客服QQ 714923