怎么也超时了啊,照道理这种思路差不多了吧
查看原帖
怎么也超时了啊,照道理这种思路差不多了吧
303399
liaohanwurao楼主2021/8/15 21:45
#include<bits/stdc++.h>
using namespace std;
int judge(int n){
    int temp;
    while(n){
        temp=n%10;
        n=n/10;
        if(temp==7){
            return 0;
            break;
        }
    }
    return 1;
}
int main(){
    int t;
    long long a[10000];
    cin>>t;
    int n;
    for(n=0;n<t;n++){
        cin>>a[n];
    }
    for(int i=0;i<n;i++){
        int count=0;
        for(int j=1;j<=a[i];j++){
            if(judge(j)){
                count++;
            }
        }
        cout<<count<<endl;
    }
    return 0;
} 
2021/8/15 21:45
加载中...