P1179 [NOIP2010 普及组] 数字统计
// Problem: P1179 [NOIP2010 普及组] 数字统计
// Contest: Luogu
// URL: https://www.luogu.com.cn/problem/P1179
// Memory Limit: 125 MB
// Time Limit: 1000 ms
// User: Pannnn
#include <bits/stdc++.h>
using namespace std;
int main() {
int l, r;
cin >> l >> r;
long long cnt = 0;
for (int i = l; i <= r; ++i) {
int t = i;
while (t) {
if (t % 10 == 2) {
++cnt;
}
t /= 10;
}
}
cout << cnt << endl;
return 0;
}