题解 | #3和5#

3和5

https://ac.nowcoder.com/acm/problem/22189

#include<iostream>
using namespace std;

int main()
{
    int n;
    cin>>n;
    for(int i=15;i<=n;i++)
    {
        bool judge=false;
        int x=i;
        while(x!=0)
        {
            if(x%10==5) judge=true;
            x/=10;
        }
        if(i%3==0&&judge) cout<<i<<endl;
    }
    
    return 0;
}


全部评论

相关推荐

迷茫的大四🐶:你这个拿去投央国企吧,投私企包过不了的
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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