AC Me

Time Limit : 2000/1000ms (Java/Other)   Memory Limit : 65536/32768K (Java/Other)
Total Submission(s) : 63   Accepted Submission(s) : 19
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
 
Author
Ignatius.L
 
Source
杭州电子科技大学第三届程序设计大赛

 #include <stdio.h>
#include <stdlib.h>
#include <string.h> int main()
{
char a[];
int i,b[],k,j;
while(gets(a))
{
int b[]={};
j=strlen(a);
for(i=;i<j;i++)
{
k=a[i]-'a';
b[k]++;
}
printf("a:%d\nb:%d\nc:%d\nd:%d\ne:%d\nf:%d\ng:%d\nh:%d\ni:%d\nj:%d\nk:%d\nl:%d\nm:%d\nn:%d\no:%d\np:%d\nq:%d\nr:%d\ns:%d\nt:%d\nu:%d\nv:%d\nw:%d\nx:%d\ny:%d\nz:%d\n\n",b[],b[],b[],b[],b[],b[],b[],b[],b[],b[],b[],b[],b[],b[],b[],b[],b[],b[],b[],b[],b[],b[],b[],b[],b[],b[]);
}
return ;
}

AC Me的更多相关文章

  1. 彻底理解AC多模式匹配算法

    (本文尤其适合遍览网上的讲解而仍百思不得姐的同学) 一.原理 AC自动机首先将模式组记录为Trie字典树的形式,以节点表示不同状态,边上标以字母表中的字符,表示状态的转移.根节点状态记为0状态,表示起 ...

  2. 基于trie树做一个ac自动机

    基于trie树做一个ac自动机 #!/usr/bin/python # -*- coding: utf-8 -*- class Node: def __init__(self): self.value ...

  3. AC自动机-算法详解

    What's Aho-Corasick automaton? 一种多模式串匹配算法,该算法在1975年产生于贝尔实验室,是著名的多模式匹配算法之一. 简单的说,KMP用来在一篇文章中匹配一个模式串:但 ...

  4. AC算法学习笔记

    1.算法流程图 (1)    void Init() 此函数是初始化函数,用来给fail数组和goto数组初始化值. (2)    void GotoFunction(string x) 这个函数的作 ...

  5. 四种比较简单的图像显著性区域特征提取方法原理及实现-----> AC/HC/LC/FT。

    laviewpbt  2014.8.4 编辑 Email:laviewpbt@sina.com   QQ:33184777 最近闲来蛋痛,看了一些显著性检测的文章,只是简单的看看,并没有深入的研究,以 ...

  6. python爬虫学习(11) —— 也写个AC自动机

    0. 写在前面 本文记录了一个AC自动机的诞生! 之前看过有人用C++写过AC自动机,也有用C#写的,还有一个用nodejs写的.. C# 逆袭--自制日刷千题的AC自动机攻克HDU OJ HDU 自 ...

  7. python爬虫学习(7) —— 爬取你的AC代码

    上一篇文章中,我们介绍了python爬虫利器--requests,并且拿HDU做了小测试. 这篇文章,我们来爬取一下自己AC的代码. 1 确定ac代码对应的页面 如下图所示,我们一般情况可以通过该顺序 ...

  8. BZOJ 2434: [Noi2011]阿狸的打字机 [AC自动机 Fail树 树状数组 DFS序]

    2434: [Noi2011]阿狸的打字机 Time Limit: 10 Sec  Memory Limit: 256 MBSubmit: 2545  Solved: 1419[Submit][Sta ...

  9. BZOJ 1030: [JSOI2007]文本生成器 [AC自动机 DP]

    1030: [JSOI2007]文本生成器 Time Limit: 1 Sec  Memory Limit: 162 MBSubmit: 3953  Solved: 1614[Submit][Stat ...

  10. BZOJ 3172: [Tjoi2013]单词 [AC自动机 Fail树]

    3172: [Tjoi2013]单词 Time Limit: 10 Sec  Memory Limit: 512 MBSubmit: 3198  Solved: 1532[Submit][Status ...

随机推荐

  1. JUnit01Eclipse添加JUnite

    JUnit 傻瓜教程 添加一個java工程 點擊右鍵選擇Properties 创建一个source folder 目的就是把测试类和被测试的类分开 添加一个类  加法 乘法 public class ...

  2. DOM对象和JQuery有什么不同的地方?

    jQuery对象和DOM对象使用说明,需要的朋友可以参考下.1.jQuery对象和DOM对象第一次学习jQuery,经常分辨不清哪些是jQuery对象,哪些是 DOM对象,因此需要重点了解jQuery ...

  3. zoj 2750 Idiomatic Phrases Game

    迪杰斯特拉单源最短路算法.对成语进行预处理.做出邻接矩阵即可. #include<cstdio> #include<cstring> #include<cmath> ...

  4. A * B Problem Plus

    A * B Problem Plus 题目链接:http://acm.split.hdu.edu.cn/showproblem.php?pid=1402 FFT(模板题) (FFT的详细证明参见算法导 ...

  5. 第二节windows系统下Xshell 5软件远程访问虚拟机 Linux系统

    下载Xshell 5软件在windows下安装 安装好后Xshell 5启动软件 下一步,检查虚拟机,配置是否正确 下一步,设置网络,保障虚拟机系统能够连接网络 下一步,进入虚拟机系统,检查虚拟机网络 ...

  6. 1、IO输入&输出流 简介

    IO流的分类: * 流向: * 输入流 读取数据 * 输出流 写出数据 * 数据类型: * 字节流 * 字节输入流 读取数据 InputStream * 字节输出流 写出数据 OutputStream ...

  7. [jquery备忘]

    has :包含,找元素里面的子元素(单个) <div><span>123</span></div> $('div').has('span').css() ...

  8. Ubuntu 14.04 apt源更新

    # 14.04 下进 my /etc/apt/sources.list /etc/apt/sources.bak vi /etc/apt/sources.list 从以下源中选择一个 源列表 Trus ...

  9. js函数的一些技巧

    1 函数的引用可以直接通过函数名来调用 bind: function (fn, scope) { return function () { return fn.apply(scope, argumen ...

  10. 索引图像(X与map)的显示、保存、转化

    有的图像载入后,出现X.map两个矩阵,那么他就是索引图像. load wbarb; figure,imshow(X,map);%显示原图 imwrite(X,map,'C:\Users\Jv\Des ...