- 数1的个数
sdghlkj
- @ 2025-4-24 20:36:48
#include<iostream>
using namespace std;
int main() {
int n, count = 0;
cin >> n;
for (int i = 1; i <= n; i++) {
int j = i;
while (j > 0) {
if (j % 10 == 1) count++;
j /= 10;
}
}
cout << count;
return 0;
}
0 条评论
目前还没有评论...
信息
- ID
- 99
- 时间
- ms
- 内存
- MiB
- 难度
- 3
- 标签
- 递交数
- 109
- 已通过
- 61
- 上传者