题解
2024-12-28 16:30:58
发布于:江苏
0阅读
0回复
0点赞
#include<iostream>
#include<cmath>
using namespace std;
int main() {
long long n,a=0,b=0,c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0;
cin>>n;
n=abs(n);
while(n!=0){
int x=n%10;
if(x==0){
a++;
}else if(x==1){
b++;
}else if(x==2){
c++;
}else if(x==3){
d++;
}else if(x==4){
e++;
}else if(x==5){
f++;
}else if(x==6){
g++;
}else if(x==7){
h++;
}else if(x==8){
i++;
}else if(x==9){
j++;
}
n/=10;
}
cout<<a<<"\n"<<b<<"\n"<<c<<"\n"<<d<<"\n"<<e<<"\n"<<f<<"\n"<<g<<"\n"<<h<<"\n"<<i<<"\n"<<j;
return 0;
}
这里空空如也
有帮助,赞一个