Run ID | Author | Problem | Lang | Verdict | Time | Memory | Code Length | Submit Time |
---|---|---|---|---|---|---|---|---|
24302 | 老方 | 数字统计 | C++ | Accepted | 0 MS | 248 KB | 232 | 2023-08-10 13:00:22 |
#include<bits/stdc++.h> using namespace std; int main() { int L,R,sum=0; cin>>L>>R; for(int i=L;i<=R;i++) { int j=i; while(j) { if(j%10==2){ sum+=1; } j/=10; } } cout<<sum; return 0; }