题目链接: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. 【Nginx】http模块的数据结构

    定义fttp模块方式很简单,比如:ngx_module_t ngx_http_mytest_module; 其中,ngx_module_t是一个Nginx模块的数据结构. typedef struct ...

  2. 创立一个站点的前前后后(起因,域名,云平台,备案,CDN等等)(1)

    起因 写完<完美软件开发:方法与逻辑>这书后,原本想继续写书的,可出来參加了些社区活动后,我发现我写的书大家评价还行.但事实上不太理解.而接下来想写的书更加抽象点.准备叫<管理的解析 ...

  3. Asp.net MVC 简单分页 自做简单分页

    Asp.net MVC 简单分页:   public static string Pager(int page,int pageSize,int total)         {           ...

  4. 【Mongodb教程 第八课 】MongoDB 更新文档

    MongoDB的 update() 和 save() 方法用于更新文档的集合. update()方法更新现有的文档值,而替换现有的文档通过的文件中 save() 方法. MongoDB Update( ...

  5. Thinking in Java -- 类型信息RTTI

    Thinking in Java – 类型信息 个人感觉 java 中的比較难的部分了,在看了些netty源代码发现事实上这块很实用. 这章重点是RTTI和反射.先说下自己的理解 RTTI是执行时识别 ...

  6. 设计模式-(7)桥接(swift版)

    一,概念 桥接模式为把抽象层次结构从实现中分离出来,使其可以独立变更,抽象层定义了供客户端使用的上层抽象接口,实现层次结构定义了供抽象层次使用的底层接口,实现类的引用被封装于抽象层的实例中,桥接就形成 ...

  7. javascript正则找script标签, link标签里面的src或者 href属性

    1. [代码]javascript 简单的search    <script(?:(?:\s|.)+?)src=[\"\'](.+?)[\"\'](?!\<)(?:(? ...

  8. Struts2中怎样配置struts。xml?

    <?xml version="1.0" encoding="UTF-8" ?><!DOCTYPE struts PUBLIC "-/ ...

  9. cmath函数整理

    double a= pow(double x, double y)://返回x的y次方. double a= sqrt(double x)://返回x的平方根. double a=ceil(doubl ...

  10. vertical-align 和line-height 以及baseline的解析

    line-height是相对于font-size来计算的,vertical-align的百分比值是相对于line-height来计算的,vertical-align的默认是baseline; demo ...