You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
372 B
23 lines
372 B
2 years ago
|
#include <cstdio>
|
||
|
#include <cstring>
|
||
|
#include <iostream>
|
||
|
#include <algorithm>
|
||
|
|
||
|
using namespace std;
|
||
|
|
||
|
const int N = 10010;
|
||
|
|
||
|
int main() {
|
||
|
int l, r;
|
||
|
cin >> l >> r;
|
||
|
|
||
|
int res = 0;
|
||
|
for (int i = l; i <= r; i++)
|
||
|
for (int j = i; j; j /= 10)
|
||
|
if (j % 10 == 2)
|
||
|
res++;
|
||
|
|
||
|
cout << res << endl;
|
||
|
|
||
|
return 0;
|
||
|
}
|