- 数字统计
dfbx
- @ 2025-4-24 20:38:03
#include <iostream>
using namespace std;
int main() {
int L, R, count = 0;
cin >> L >> R;
for (int i = L; i <= R; ++i) { // 遍历区间内每个数
int num = i;
while (num > 0) { // 逐位检查
if (num % 10 == 2) count++;
num /= 10;
}
}
cout << count << endl;
return 0;
}
0 条评论
目前还没有评论...
信息
- ID
- 100
- 时间
- ms
- 内存
- MiB
- 难度
- 1
- 标签
- 递交数
- 80
- 已通过
- 53
- 上传者