题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1219

Problem Description

Ignatius is doing his homework now. The teacher gives him some articles and asks him to tell how many times each letter appears.
It's really easy, isn't it? So come on and AC ME.

Input

Each article consists of just one line, and all the letters are in lowercase. You just have to count the number of each letter, so do not pay attention to other characters. The length of article is at most 100000. Process to the end of file.
Note: the problem has multi-cases, and you may use "while(gets(buf)){...}" to process to the end of file.

Output

For each article, you have to tell how many times each letter appears. The output format is like "X:N". 
Output a blank line after each test case. More details in sample output.

Sample Input

hello, this is my first acm contest!
work hard for hdu acm.

Sample Output

a:1
b:0
c:2
d:0
e:2
f:1
g:0
h:2
i:3
j:0
k:0
l:2
m:2
n:1
o:2
p:0
q:0
r:1
s:4
t:4
u:0
v:0
w:0
x:0
y:1
z:0
 
a:2
b:0
c:1
d:2
e:0
f:1
g:0
h:2
i:0
j:0
k:1
l:0
m:1
n:0
o:2
p:0
q:0
r:3
s:0
t:0
u:1
v:0
w:1
x:0
y:0
z:0

水题!!!

AC代码:

 #include<bits/stdc++.h>
using namespace std;
char a[];
int b[],len;
int main()
{
char ch='a';
while(gets(a)){
memset(b,,sizeof(b));
len=strlen(a);
for(int i=;i<len;i++)if(a[i]>='a'&&a[i]<='z')b[a[i]-'a']++;//遇到字母就保存到b数组里面
for(int i=;i<;i++)
printf("%c:%d\n",ch+i,b[i]);
cout<<endl;
}
return ;
}

题解报告:hdu1219AC Me的更多相关文章

  1. 2015浙江财经大学ACM有奖周赛(一) 题解报告

    2015浙江财经大学ACM有奖周赛(一) 题解报告 命题:丽丽&&黑鸡 这是命题者原话. 题目涉及的知识面比较广泛,有深度优先搜索.广度优先搜索.数学题.几何题.贪心算法.枚举.二进制 ...

  2. cojs 强连通图计数1-2 题解报告

    OwO 题目含义都是一样的,只是数据范围扩大了 对于n<=7的问题,我们直接暴力搜索就可以了 对于n<=1000的问题,我们不难联想到<主旋律>这一道题 没错,只需要把方程改一 ...

  3. cojs 二分图计数问题1-3 题解报告

    OwO 良心的FFT练手题,包含了所有的多项式基本运算呢 其中一部分解法参考了myy的uoj的blog 二分图计数 1: 实际是求所有图的二分图染色方案和 我们不妨枚举这个图中有多少个黑点 在n个点中 ...

  4. 题解报告:hdu 1398 Square Coins(母函数或dp)

    Problem Description People in Silverland use square coins. Not only they have square shapes but also ...

  5. 题解报告:hdu 2069 Coin Change(暴力orDP)

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2069 Problem Description Suppose there are 5 types of ...

  6. 题解报告:hdu 1028 Ignatius and the Princess III(母函数or计数DP)

    Problem Description "Well, it seems the first problem is too easy. I will let you know how fool ...

  7. CF Educational Round 78 (Div2)题解报告A~E

    CF Educational Round 78 (Div2)题解报告A~E A:Two Rival Students​ 依题意模拟即可 #include<bits/stdc++.h> us ...

  8. CF1169(div2)题解报告

    CF1169(div2)题解报告 A 不管 B 首先可以证明,如果存在解 其中必定有一个数的出现次数大于等于\(\frac{m}{2}\) 暴力枚举所有出现次数大于等于$\frac{m}{2} $的数 ...

  9. CFEducational Codeforces Round 66题解报告

    CFEducational Codeforces Round 66题解报告 感觉丧失了唯一一次能在CF上超过wqy的机会QAQ A 不管 B 不能直接累计乘法打\(tag\),要直接跳 C 考虑二分第 ...

  10. CF Round #580(div2)题解报告

    CF Round #580(div2)题解报告 T1 T2 水题,不管 T3 构造题,证明大约感性理解一下 我们想既然存在解 \(|a[n + i] - a[i]| = 1\) 这是必须要满足的 既然 ...

随机推荐

  1. 安装软件:/lib/ld-linux.so.2: bad ELF interpreter解决

    http://linux.chinaitlab.com/set/928509.html 我们在CentOS系统中安装软件:/lib/ld-linux.so.2: bad ELF interpreter ...

  2. [转] Scalers:刻意练习的本质就是持续行动+刻意学习

    原文: http://www.scalerstalk.com/1264-peak-conscious ------------------------------------------------- ...

  3. DataGridView依据下拉列表显示数据

    我们都知道,DataGridView能够直接绑定数据源.显示数据库中的数据.可是我想做的是能够对他进行条件查询,依据用户级别选择不同级别的记录. 以上这个控件就是DataGridView控件,能够用它 ...

  4. 【转】PLSQL_标准删除的方式Delete/Drop/Truncate区别和比较

  5. Windows驱动程序开发基础(四)驱动的编译调试和安装

    Windows驱动程序开发基础,转载标明出处:http://blog.csdn.net/ikerpeng/article/details/38793995 以下说一下开发出来驱动程序以后怎样编译.一般 ...

  6. 自定义的强大的UITableViewCell

    UITableView的强大更多程度上来自于可以任意自定义UITableViewCell单元格.通常,UITableView中的Cell是动态的,在使用过程中,会创建一个Cell池,根据每个cell的 ...

  7. pip 安装速度慢解决办法

    https://blog.csdn.net/liujingclan/article/details/50176597 https://blog.csdn.net/rytyy/article/detai ...

  8. iPhone开发关于UDID和UUID的一些理解【转】

    原文地址:http://blog.csdn.net/xunyn/article/details/13629071 一.UDID(Unique Device Identifier) UDID是Uniqu ...

  9. 初识 flask

    1,Python现阶段三大主流web框架Django, Tornado, Flask对比 Django主要特点是大而全,集成了很多组件,列如:Models Admin Form等等,不管用得用不着反正 ...

  10. slf4j的总结

    参考文章 log4j2使用总结 slf4j介绍以及实现原理窥探 使用Slf4j集成Log4j2构建项目日志系统的完美解决方案 slf4j(全称是Simple Loging Facade For Jav ...