#include<bits/stdc++.h> using namespace std; int main() { int n=0,M=0; cin>>n; for(int i=1;i<=n;i++) { int a=i; while(a>0) { if(a%10==1) { M=M+1; } a=a/10; } } cout<<M; return 0; }
By signing up a 羽润编程 universal account, you can submit code and join discussions in all online judging services provided by us.
Using your 羽润编程 universal account