题解 | #自守数#

自守数

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

const rl = require("readline").createInterface({ input: process.stdin });
var iter = rl[Symbol.asyncIterator]();
const readline = async () => (await iter.next()).value;

void async function () {
    // Write your code here
    let line = await readline()
    line = Number(line)
    let res = 0
    for (let i = 0; i <= line; i++) {
        let tmp = String(i * i)
        if (tmp.substring(tmp.length - String(i).length) === String(i)) {
            res++
        }
    }
    console.log(res)
}()

全部评论

相关推荐

特斯联 后端开发 300 + 450餐补
点赞 评论 收藏
转发
点赞 收藏 评论
分享
牛客网
牛客企业服务