Files
python/LuoGu/RuMen/P1179.cpp
HuangHai 1f397eca87 'commit'
2025-08-30 18:35:01 +08:00

18 lines
386 B
C++

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
ll a, b, s = 0, n;
cin >> a >> b;
for (ll y = a; y <= b; y++) {
n = y;//不能改变循环变量的原值,所以要找“替身”
while (n != 0) {
if (n % 10 == 2) s++;
n /= 10;
}
}
cout << s << endl;
return 0;
}