题解
2025-05-11 13:25:27
发布于:浙江
0阅读
0回复
0点赞
#include<bits/stdc++.h>
using namespace std;
int m,n,d,e,f,g,h,u,j,k;
int main(){
int a,b,c;
cin>>a;
for(int i=1;i<=a;i++){
b=i;
while(b!=0){
c=b%10;
if(c==0){
m++;
}
else if(c==1){
n++;
}
else if(c==2){
d++;
}
else if(c==3){
e++;
}
else if(c==4){
f++;
}
else if(c==5){
g++;
}
else if(c==6){
h++;
}
else if(c==7){
u++;
}
else if(c==8){
j++;
}
else{
k++;
}
b/=10;
}
}
cout<<"0,"<<m<<endl;
cout<<"1,"<<n<<endl;
cout<<"2,"<<d<<endl;
cout<<"3,"<<e<<endl;
cout<<"4,"<<f<<endl;
cout<<"5,"<<g<<endl;
cout<<"6,"<<h<<endl;
cout<<"7,"<<u<<endl;
cout<<"8,"<<j<<endl;
cout<<"9,"<<k<<endl;
return 0;
}
这里空空如也
有帮助,赞一个