题解 | #数组分组#

自守数

http://www.nowcoder.com/practice/88ddd31618f04514ae3a689e83f3ab8e

let line

while(line = readline()){
    let num = parseInt(line);
    let count = 0
    for(let i=0;i<=num;i++){
        let idot = String(i)
        if(idot.endsWith('0')||idot.endsWith('1')||idot.endsWith('5')||idot.endsWith('6')){
            let power = Math.pow(i,2);
            let str = String(power)
            if(str.endsWith(idot)){
                count++
            }
        }
    }
    console.log(count)
}
全部评论

相关推荐

05-14 20:34
门头沟学院 Java
窝补药贝八股:管他们,乱说,反正又不去,直接说680
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务