提交时间:2023-02-01 14:47:04

运行 ID: 7178

#include<bits/stdc++.h> using namespace std; int main() { int R; cin>>R; int total=0; for(int i=1;i<=R;i++){ int x=i; while(x>0){ int g=x%10; x=x/10; if(g==1){ total+=1; } } } cout<<total; return 0; }