当前位置:网站首页>2. single digit statistics
2. single digit statistics
2022-06-28 11:46:00 【HBUcs2020】
#include<iostream>
using namespace std;
#include<string>
#include<cstring>
int main()
{
string s;
getline(cin,s);
int num[10];
memset(num,0,sizeof(num));
for(int i=0;i<s.size();i++)
{
char c=s[i];
int n=c-'0';
num[n]++;
}
for(int i=0;i<10;i++)
{
if(num[i])
{
printf("%d:%d\n",i,num[i]);
}
}
return 0;
}#include<iostream>
using namespace std;
#include<map>
int main()
{
char c;
map<int,int>mp;
while((c=getchar())!='\n')
mp[c-'0']++;
for(map<int,int>::iterator it=mp.begin();it!=mp.end();it++)
{
cout<<it->first<<":"<<it->second<<endl;
}
return 0;
}边栏推荐
- New listing of operation light 3.0 - a sincere work of self subversion across the times!
- Excel import / export convenience tool class
- Introduction to GDB
- day39 原型链及页面烟花效果 2021.10.13
- Pre parsing, recursive functions and events in day25 JS 2021.09.16
- Random forest and poetry maker trained by AMR
- Simple understanding of ThreadLocal
- Day34 JS notes regular expression 2021.09.29
- 赛尔号抽奖模拟求期望
- GCC introduction
猜你喜欢

Scientific research - web of science retrieval skills

New listing of operation light 3.0 - a sincere work of self subversion across the times!

2022中国信通院首届业务与应用安全发展论坛成功召开!

QML控件类型:TabBar

Redis6 1: what problems can be solved by the introduction of NoSQL and redis?

科研丨Web of Science检索技巧

Day34 JS notes regular expression 2021.09.29

Day39 prototype chain and page Fireworks Effect 2021.10.13

Day39 prototype chain and page fireworks effect 2021.10.13

Array method in JS 2021.09.18
随机推荐
day37 js笔记 运动函数 2021.10.11
day25 js中的预解析、递归函数、事件 2021.09.16
Adding a new user in MySQL 5.7
Mysql使用max函数查询不到最大值
Unity screenshot function
随机森林以及 AMR 训练出的诗词制造器
day23 js笔记 2021.09.14
day30 js笔记 BOM和DOM 2021.09.24
Zero foundation self-study SQL course | if function
Gee: mcd64a1 based globfire daily fire data set
Xshell and xftp tutorial
什么是主链系统?
The default point of this in JS and how to modify it to 2021.11.09
TiDB v6.0.0 (DMR) :缓存表初试丨TiDB Book Rush
Splicing strings in the string collection_ Stream based
Jetpack Compose Desktop 桌面版本的打包和发布应用
[sword finger offer] 49 Ugly number
Calculate time using calendar
day32 js笔记 事件(上)2021.09.27
Intranet penetration in the working group environment: some basic methods