'commit'
This commit is contained in:
18
LuoGu/RuMen/P1179.cpp
Normal file
18
LuoGu/RuMen/P1179.cpp
Normal file
@@ -0,0 +1,18 @@
|
||||
#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;
|
||||
}
|
||||
Reference in New Issue
Block a user