0 Time Exceeded

# 状态 分数 耗时 内存占用
#1 Time Exceeded 0 ≥1330ms ≥7.4 MiB
#2 Time Exceeded 0 ≥1333ms ≥7.4 MiB
#3 Time Exceeded 0 ≥1332ms ≥7.4 MiB
#4 Time Exceeded 0 ≥1331ms ≥7.6 MiB
#5 Time Exceeded 0 ≥1333ms ≥7.6 MiB
#6 Time Exceeded 0 ≥1332ms ≥7.4 MiB
#7 Time Exceeded 0 ≥1331ms ≥7.6 MiB
#8 Time Exceeded 0 ≥1333ms ≥7.5 MiB
#9 Time Exceeded 0 ≥1333ms ≥7.6 MiB
#10 Time Exceeded 0 ≥1333ms ≥7.4 MiB

代码

#include <iostream>
#include <iomanip>
using namespace std;
int main()
{
    int n ,sum=0;
    cin>>n;
    for (int i = 1; i <= n;i++)
    {
        int p=i,flag=0;
        if (p%7==0) 
        {
            flag=1;
        }
        while(p!=0)
        {
            if(p%10==7) 
            {
                flag=1;
                p/=10;
            }
        }
        if(flag) 
        {
            sum+=i;
        }
    }
    cout << sum;
    return 0;
}

信息

递交者
题目
DJKS1014  特殊求和
比赛
2024年3月等考一级题单
语言
C++ 98
递交时间
11 个月前
评测时间
11 个月前
分数
0
总耗时
≥13322ms
峰值内存
≥7.6 MiB