Run ID | Author | Problem | Lang | Verdict | Time | Memory | Code Length | Submit Time |
---|---|---|---|---|---|---|---|---|
56393 | zhangweiran | 数字统计 | C++ | Accepted | 0 MS | 264 KB | 357 | 2024-11-11 07:14:31 |
#include<iostream> #include<cmath> using namespace std; int main() { int l,r,s=0; cin>>l>>r; for(int i1=l;i1<=r;i1++) { for(int i2=1;i2<=11;i2++) { int a=i1; a%=(int)pow(10,i2); a/=(int)pow(10,i2-1); if(a==2) s++; } } cout<<s; return 0; }