题解 | #数组分组#

自守数

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)
}
全部评论

相关推荐

小叮当411:应该是1-3个月吧
点赞 评论 收藏
分享
07-08 13:48
门头沟学院 C++
点赞 评论 收藏
分享
求offer的大角牛:不吃香菜
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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