Submit Time:2024-04-02 20:32:11

运行 ID: 44727

#include <bits/stdc++.h> using namespace std; int main(){ int a,b,sum = 0;; cin >> a; cin >> b; for(int i = a;i <= b;i ++){ if(i % 10 == 2){ sum ++; } if(i /10 % 10 == 2){ sum ++; } if(i /100 % 10 == 2){ sum ++; } } cout << sum; return 0; }