6 条题解

  • 0
    @ 2026-7-21 22:48:34
    #include<bits/stdc++.h>
    using namespace std;
    int main(){
    	int n,cnt=0,t;
    	cin>>n;
    	for(int i=1;i<=n;i++){
    		t=i;
    		while(t>0){ //拆分数位
    			if(t%10==1)
    			cnt++;
    			t/=10;
    		}
    	}
    	cout<<cnt;
        return 0;
    }
    //可直接用
    

    信息

    ID
    942
    时间
    1000ms
    内存
    128MiB
    难度
    3
    标签
    递交数
    195
    已通过
    107
    上传者