题解 | 挑7

挑7

https://www.nowcoder.com/practice/ba241b85371c409ea01ac0aa1a8d957b

#include <cstdlib>
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;

int main() {
    int a;
    cin >> a;
    if (a < 7) {
        return 0;
    }
    int count = 0;
    for (int i = 7 ; i <= a; i++) {
        string temp = to_string(i);
        if (i % 7 == 0) {
            count++;
        } else {
            for (char c : temp) {
                if (c == '7') {
                    count++;
                    break;
                }
            }
        }
    }
    cout <<count<<endl;
    return 0;
}
// 64 位输出请用 printf("%lld")

开心,这题一遍过,嘿嘿

全部评论

相关推荐

10-24 00:54
已编辑
门头沟学院 Java
牛客20646354...:这连小厂都找不到就离谱,只能说可能你根本没投什么小厂。说实话现在都要11月了,没什么岗位了。其实最好是在9月找,那时候暑假工刚走,岗位多的是,现在都占满了岗位了,秋招的秋招,顶替暑假工的也基本上都顶替了。 只能多投了,简历其实都差不多,你这都不是外卖+点评去找实习了,已经比好多人优秀了。实在找不到,可以降低一些标准的,能投到自研项目的小厂说实话可能比你去中大厂能学到更多东西。因为中大厂最多给你看一点点模块功能,小厂基本上全部代码甚至几个项目的代码都能拿到。
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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