提交时间:2023-11-06 20:31:06

运行 ID: 30324

#include <bits/stdc++.h> using namespace std; int main(){ int n, cnt = 0; cin >> n; for (int i = 1; i <= n; i++){ int t = i; while(t != 0){ if(t % 10 == 1){ cnt ++; } t /= 10; } } cout << cnt; return 0; }