shuni9 大佬有话说 :
来做小学题:能被3整除,但是不含1的5位数有多少个?
能被3整除,但是不能含有数字1,的5位数,有多少个呢
h20 大佬有话说 :
本帖最后由 h20 于 2021-9-10 16:07 编辑
自己记事本写个脚本 几行代码的事
c473432 大佬有话说 :
本帖最后由 c473432 于 2021-9-10 16:08 编辑
//储存结果
const result = []
// 暴力循环
for(let i = 10000; i < 100000; i++) {
// 能被三整除
if (i % 3 === 0) {
// 数字中不含 1
if(i.toString().indexOf(‘1’) === -1 ) {
result.push(i)
}
}
}
console.log(result)
代码贴到浏览器控制台就可以, 结果是 17490 个
larry528 大佬有话说 :
一行解决:lol
https://i.ibb.co/Zzpwt94/image.png
二氧化碳 大佬有话说 :
一共17490个
https://tu.sunpma.com/imgs/2021/09/9eb741d4d452924c.jpg
asd1314s 大佬有话说 :
很多个https://cdn.jsdelivr.net/gh/master-of-forums/master-of-forums/public/images/patch.gif
clcomeon 大佬有话说 :
好多号好多好多个
maracaibodu 大佬有话说 :
无数个
买鸡吃灰 大佬有话说 :
我才刚读幼稚园你忍心让我做这种题吗yc005t
929900276 大佬有话说 :
口算下,大概30000个?
我是坏虫 大佬有话说 :
不能又1,那就从20000开始算,一直到99999
A4纸不够怎么办?https://cdn.jsdelivr.net/gh/master-of-forums/master-of-forums/public/images/patch.gif
larry528 大佬有话说 :
17490
betoin 大佬有话说 :
x个