- 历届试题 核桃的数量
 特殊求和
- @ 2023-7-27 13:59:48
 
#include <bits/stdc++.h>
using namespace std;
bool m(int x)
{
    int a=x;
    while(a>0)
    {
        if(a%10==7)
        {
            return true;
        }
        a=a/10;
    }
    return false;
}
int main()
{
    int N;
    int sum=0;
    cin>>N;
    for(int i=1;i<=N;i++)
    {
        if(i%7==0||m(i)==true)
        {
            sum+=i;
        }
    }
    cout<<sum;
    return 0;
}
        0 comments
  
  No comments so far...
            Information
- ID
 - 640
 - Time
 - 1000ms
 - Memory
 - 256MiB
 - Difficulty
 - 7
 - Tags
 - # Submissions
 - 33
 - Accepted
 - 10
 - Uploaded By