题解 | 牛牛数数

牛牛数数

https://www.nowcoder.com/practice/03a3cc96fa4847b387bf58bb800d67cf

#include <iostream>
using namespace std;

bool withFour(int n) {
    while (n != 0) {
        if (n % 10 == 4) return true;
        n /= 10;
    }
    return false;
}

int main() {
    int n;
    cin >> n;
    for (int i = 1; i <= n; i++) {
        if (i % 4 == 0) continue;
        if (withFour(i)) continue;
        cout << i << endl;
    }
}
// 64 位输出请用 printf("%lld")

全部评论

相关推荐

有没有佬投这个呀,怎么样呀求问
投递中科院空天信息创新研究院等公司7个岗位
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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