题解 | #包含数字9的数#

包含数字9的数

http://www.nowcoder.com/practice/0948f4f3344c452f843afd3585dd0f8d

int main()
{
    int i = 0;
    int count = 0;
    for (i = 9; i <= 2019; i++)
    {
        int t = i;
        while (t)
        {
            if (t % 10 == 9)
            {
                count++;
                break;
            }
            t = t / 10;
        }
    }
    printf("%d\n", count);
    return 0;
}
全部评论

相关推荐

点赞 评论 收藏
分享
流浪的神仙:无恶意,算法一般好像都得9硕才能干算法太卷啦
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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