syhd142  
日历
<2026年10月>
日一二三四五六
27282930123
45678910
11121314151617
18192021222324
25262728293031
1234567
统计
  • 随笔 - 23
  • 文章 - 122
  • 评论 - 31
  • 引用 - 0

导航

常用链接

留言簿(2)

随笔档案(23)

文章分类(270)

文章档案(122)

我的豆瓣

搜索

  •  

最新评论

阅读排行榜

评论排行榜

 
拼写检查
#include <stdio.h>
#include 
<string.h>

int hash[255];

void init()
{
    hash[
'B'] = hash['F'] = hash['P'] = hash['V'] = 1;
    hash[
'C'] = hash['G'] = hash['J'] = hash['K'] = 2;
    hash[
'Q'] = hash['S'] = hash['X'] = hash['Z'] = 2;
    hash[
'D'] = hash['T'] = 3;
    hash[
'L'] = 4;
    hash[
'M'] = hash['N'] = 5;
    hash[
'R'] = 6;
}

int main()
{
    init();
    
int ans[25], top;
    
char data[25];
    
while(gets(data))
    {
        top 
= 1;
        
int l = strlen(data);
        
for(int i = 0; i < l; i++)
        {
            
int t = hash[data[i]];
            
if(t == ans[top - 1]) continue;
            ans[top
++] = t;
        }
        
for(int i = 1; i < top; i++)
        {
            
if(ans[i]) printf("%d", ans[i]);
        }
        printf(
"\n");
    }
    
return 0;
}
posted on 2010-10-08 14:55 Fucker 阅读(260) 评论(0)  编辑 收藏 引用 所属分类: ACM/ICPC 、简单
 
Copyright © Fucker Powered by: 博客园 模板提供:沪江博客