题解 | #挑7#

挑7

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

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

int main() {
    int n,ans;
    ans=0;
    cin>>n;
    while(n){
        if(n%7==0||to_string(n).find('7')<=4) ans++;
        //cout<<n<<' '<<to_string(n).find('7')<<endl;
        n--;
    }
    cout<<ans<<endl;
}
// 64 位输出请用 printf("%lld")

!=string::npos不知道为什么是true ,只能<=4了

全部评论

相关推荐

06-13 17:00
武汉大学 Java
6月了还有点击就送的offer吗😭,投麻了😢
叫我阿东就行:这个bg,也还没找到理想的工作吗?好难,好焦虑
点赞 评论 收藏
分享
每晚夜里独自颤抖:把华北改为华南再试一试,应该就没啥问题了。改完可能都不用投,别人主动联系了。
点赞 评论 收藏
分享
牛客928043833号:在他心里你已经是他的员工了
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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