提交时间:2024-12-12 17:20:55
运行 ID: 314207
#include <iostream> using namespace std; int main() { int a,b,j = 0,y; cin >> a >> b; for(int i = a;i <= b;i++){ y = i; while(1){ if(y == 0){ break; } if(y % 10 == 2){ j++; } y /= 10; } } cout << j; return 0; }