当前位置:网站首页>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;
}边栏推荐
- js中的class类模式及语法 2021.11.10
- 分析list中有无重复数据且重复了几次
- Contract quantification system development (construction explanation) - contract quantification system development (source code analysis and ready-made cases)
- 来吧元宇宙,果然这热度一时半会儿过不去了
- 2022 开源软件安全状况报告:超41%的企业对开源安全没有足够的信心
- Day34 JS notes regular expression 2021.09.29
- Day31 JS notes DOM 2021.09.26
- Compareto() and equals() methods of BigDecimal class
- NFT卡牌链游系统开发dapp搭建技术详情
- Practice and Thinking on the architecture of a set of 100000 TPS im integrated message system
猜你喜欢

Practice and Thinking on the architecture of a set of 100000 TPS im integrated message system

Deployment and optimization of vsftpd service

Array method in JS 2021.09.18

Thesis reading (59):keyword based diverse image retrieval with variable multiple instance graph

Day37 JS note motion function 2021.10.11

Ali three sides: what is the difference between using on or where in the left join associated table and the condition

人人都可以参与开源!龙蜥社区最不容错过的开发者活动来了

Packaging and publishing application of jetpack compose desktop version

Day31 JS notes DOM 2021.09.26

day31 js笔记 DOM下 2021.09.26
随机推荐
QML控件类型:TabBar
Which programming language will attract excellent talents?
day29 js笔记 2021.09.23
Contract quantitative trading system development | contract quantitative app development (ready-made cases)
js中的class类模式及语法 2021.11.10
String & heap & method area
关于Pytorch中双向LSTM的输出表示问题
Makefile introduction
Excel导入导出便捷工具类
Recommended practice sharing of Zhilian recruitment based on Nebula graph
李宏毅《机器学习》丨7. Conclusion(总结)
零基础自学SQL课程 | IF函数
Thesis reading (59):keyword based diverse image retrieval with variable multiple instance graph
setInterval、setTimeout和requestAnimationFrame
一套十万级TPS的IM综合消息系统的架构实践与思考
MySQL cannot query the maximum value using the max function
合约量化交易系统开发 | 合约量化APP开发(现成案例)
Introduction to GDB
Machine learning project captcha based on verification code recognition_ Trainer operation practice
Using soapUI to obtain freemaker's FTL file template