提交时间:2026-04-10 14:31:38

运行 ID: 86864

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