文章

246

粉丝

0

获赞

1150

访问

46.5k

头像
7 题解:
P1198 北京大学上机题
发布于2026年3月27日 17:29
阅读数 27

#include<iostream>
using namespace std;

int n,res;

bool check(int x)
{
    if(x%7==0)
    return true;
    while(x)
    {
        if(x%10==7)
        return true;
        x/=10;
    }
    return false;
}

int main()
{
    while(cin>>n)
    {
        res=0;
        for(int i=1;i<=n;i++)
        if(!check(i))
        res+=i*i;
        cout<<res<<endl;
    }
    return 0;
}

 

登录查看完整内容


登录后发布评论

暂无评论,来抢沙发