1021 个位数统计 (15 分)

#include<bits/stdc++.h>

using namespace std;

int main(){
    int a[11] = {0};
    string n;
    cin>>n;
    for(int i=0; i<n.length(); i++){
        int x = n[i]-'0';
        a[x]++;
    }
    for(int i=0; i<10; i++){
        if(a[i]!=0)
            cout<<i<<":"<<a[i]<<endl;
    }
    return 0;
}

相关文章:

  • 2022-02-20
  • 2022-12-23
  • 2021-07-04
  • 2021-07-15
  • 2022-12-23
  • 2021-12-21
  • 2022-12-23
  • 2021-06-08
猜你喜欢
  • 2021-11-04
  • 2022-12-23
  • 2022-01-23
  • 2021-06-15
  • 2022-12-23
  • 2021-07-08
相关资源
相似解决方案