0
1
mirror of https://git.sb/baoshuo/OI-codes.git synced 2024-12-26 17:52:00 +00:00
OI-codes/Luogu/P1179/P1179.cpp

24 lines
323 B
C++
Raw Normal View History

#include <bits/stdc++.h>
using namespace std;
int l, r, ans;
int cnt2(int x) {
int res = 0;
while (x) {
res += x % 10 == 2;
x /= 10;
}
return res;
}
int main() {
cin >> l >> r;
for (int i = l; i <= r; i++) {
ans += cnt2(i);
}
cout << ans << endl;
return 0;
}