当前位置:网站首页>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;
}边栏推荐
- On the output representation of bidirectional LSTM in pytoch
- 来吧元宇宙,果然这热度一时半会儿过不去了
- Cannot redeclare block range variables
- Practice and Thinking on the architecture of a set of 100000 TPS im integrated message system
- 选择哪种编程语言,会吸引优秀的人才?
- Characteristics of solar wireless LED display
- 合约量化系统开发(搭建讲解)丨合约量化系统开发(源码解析及现成案例)
- When an entity is converted to JSON, the field with null value is lost
- 零基础自学SQL课程 | IF函数
- 李宏毅《机器学习》丨7. Conclusion(总结)
猜你喜欢

The default point of this in JS and how to modify it to 2021.11.09

Day30 JS notes BOM and DOM 2021.09.24

JS foundation 8

Day36 JS notes ecma6 syntax 2021.10.09

Jetpack Compose Desktop 桌面版本的打包和发布应用

零基础自学SQL课程 | IF函数

Scientific research - web of science retrieval skills

js中的数组方法 2021.09.18
This Exception was thrown from a job compiled with Burst, which has limited exception support. report errors

培训通知|2022年境外中资企业机构及人员疫情防控和安全防范专题培训通知
随机推荐
Adding a new user in MySQL 5.7
水果FL Studio/Cubase/Studio one音乐宿主软件对比
ProCAST finite element casting process simulation software
Graduated
Graduation season, some suggestions for you who are new to the society
什么是主链系统?
[sciter]: use of sciter FS module scanning file API and its details
[sciter]: how sciter uses i18 to realize multi language switching of desktop applications and its advantages and disadvantages
Making and using of static library
Practice and Thinking on the architecture of a set of 100000 TPS im integrated message system
买股票在中金证券经理的开户二维码上开户安全吗?求大神赐教
Day24 JS notes 2021.09.15
day39 原型链及页面烟花效果 2021.10.13
Apache2 configuration denies access to the directory, but can access the settings of the files inside
工作组环境下的内网渗透:一些基础打法
The development and principle of the metacosmic system
day36 js笔记 ECMA6语法 2021.10.09
JS foundation 8
Excel import / export convenience tool class
QML control type: tabbar