1 条题解

  • 0
    @ 2026-3-22 23:13:28

    #include<bits/stdc++.h> using namespace std;

    int main(){ int n,k,cs=0; cin>>n>>k; for(int i=1;i<=n;i++){ int cs2=0; for(int j=1;j<=1000000;j*=10){ if(i/j%10<=k){ cs2+=1; } } if(cs2==7){ cs+=1; } } cout<<cs; return 0;

    #include<bits/stdc++.h>
    using namespace std;
    
    int main(){
    	int n,k,cs=0;
    	cin>>n>>k;
    	for(int i=1;i<=n;i++){
    		int cs2=0;
    		for(int j=1;j<=1000000;j*=10){
    			if(i/j%10<=k){
    				cs2+=1;
    			}
    		}
    		if(cs2==7){
    			cs+=1;
    		}
    	}
    	cout<<cs;
    	return 0;
    }
    }
    
    • 1

    信息

    ID
    3500
    时间
    1000ms
    内存
    256MiB
    难度
    8
    标签
    递交数
    37
    已通过
    5
    上传者