题目链接: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. Meteor会话

    会话用于当用户在使用应用程序时保存数据.当用户离开应用这些数据将被删除. 在本教程中,我们将学习如何设置会话对象,存储一些数据并返回数据.我们将使用基本的HTML设置. meteorApp/impor ...

  2. AngularJS - $index, $event, $log

    原文: https://thinkster.io/egghead/index-event-log --------------------------------------------------- ...

  3. uva 10069 Distinct Subsequences 【dp+大数】

    题目:uva 10069 Distinct Subsequences 题意:给出一个子串 x 和母串 s .求子串在母串中的不同序列的个数? 分析:定义dp[i][j]:x 的前 i 个字母在 s 的 ...

  4. [RxJS] Implement the `map` Operator from Scratch in RxJS

    While it's great to use the RxJS built-in operators, it's also important to realize you now have the ...

  5. Office Adobe Acrobat把PDF转换为Word时候提示不支持的Type2字体怎么办

    如下图所示,在使用Adobe Acrobat Pro9将PDF转换为Word的时候出现下面的错误   很简单,不要用Adobe Acrobat Pro9了,用Adobe Acrobat Pro X,还 ...

  6. react 项目中 引入 bootstrap

    react-bootstrap是一个非常受欢迎的针对react封装过的bootstrap,它本身不包含css,所以也是需要使用bootstrap原生库. 在create-react-app建的项目目录 ...

  7. Dubbo应用启动与停止脚本,超具体解析

    本周刚好研究了一下dubbo的启动脚本,所以在官网的启动脚本和公司内部的启动脚本做了一个整理,弄了一份比較通过的Dubbo应用启动和停止脚本.          以下的脚本仅仅应用于配置分离的应用.什 ...

  8. I2S简单学习

    以下只是个人看法,有不妥之处,请批评指出. 参考资料:http://blog.csdn.net/ce123_zhouwei/article/details/6919954: 一.I2S接口简述 I²S ...

  9. DDM的成熟在一个细微之处的体现

    前言 我们都知道DDM是华为云的非常优秀的分布式数据库中间件,在性能.易用性等方面在业界是遥遥领先的.他的成熟不仅仅体现在具有快速水平平滑扩容,支持多种分布式事物类型等等这些高大上的特性上,也体现在D ...

  10. iOS 用xib自定义View

      网上有很多关于实现用xib自定义View,那我为什么还要写呢?第一,我用他们的方法都没有实现.第二,用xib遇到了很多问题,想分享给大家.    用xib自定义View:FHCustomView ...