10 条题解

  • 1
    @ 2025-12-28 14:37:08
    #include <iostream>
    using namespace std;
    int n,ans;
    bool yes = true;
    int main()
    {
    	cin >> n;
    	for (int i = 1;i <= n;i++)
    	{
    		if (i % 7 == 0)
    			continue;
    		int j = i;
    		while (j != 0)
    		{
    			if (j % 10 == 7)
    			{
    				yes = false;
    				break; 
    			}
    			j /= 10;
    		}
    		if (yes == true)
    			ans += i * i;
    		yes = true;
    	}
    	cout << ans;
    	return 0;
    }

    信息

    ID
    970
    时间
    1000ms
    内存
    128MiB
    难度
    4
    标签
    递交数
    466
    已通过
    232
    上传者