提交时间:2024-10-24 22:28:31

运行 ID: 53659

#include <iostream> using namespace std; int main() { int L, R; cin >> L >> R; int count = 0; for (int i = L; i <= R; i++) { int t = i; while (t > 0) { if (t % 10 == 2) { count++; } t /= 10; } } cout << count << endl; return 0; }