The Country List

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)

Total Submission(s): 2464    Accepted Submission(s): 576

Problem Description
As the 2010 World Expo hosted by Shanghai is coming, CC is very honorable to be a volunteer of such an international pageant. His job is to guide the foreign visitors. Although he has a strong desire to be an excellent volunteer, the lack of English makes him
annoyed for a long time. 

Some countries’ names look so similar that he can’t distinguish them. Such as: Albania and Algeria. If two countries’ names have the same length and there are more than 2 same letters in the same position of each word, CC cannot distinguish them. For example:
Albania and AlgerIa have the same length 7, and their first, second, sixth and seventh letters are same. So CC can’t distinguish them.

Now he has received a name list of countries, please tell him how many words he cannot distinguish. Note that comparisons between letters are case-insensitive.
 
Input
There are multiple test cases.

Each case begins with an integer n (0 < n < 100) indicating the number of countries in the list.

The next n lines each contain a country’s name consisted by ‘a’ ~ ‘z’ or ‘A’ ~ ‘Z’.

Length of each word will not exceed 20.

You can assume that no name will show up twice in the list.
 
Output
For each case, output the number of hard names in CC’s list.
 
Sample Input
3
Denmark
GERMANY
China
4
Aaaa
aBaa
cBaa
cBad
 
Sample Output
2
4
 

总是望着曾经的空间发呆,那些说好不分开的朋友不在了,转身,陌路。 熟悉的,安静了, 安静的,离开了, 离开的,陌生了, 陌生的,消失了, 消失的,陌路了。

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int da[105]= {0};
void bijiao(int n,char c[105][30])
{
int i,j,t=0,q;
for(i=0; i<n; i++)
for(j=0; j<n; j++)
{
t=0;
if(strcmp(c[i],c[j])==0)continue;
if(strlen(c[i])==strlen(c[j]))
{
for(q=0; q<(int)strlen(c[i]); q++)
{
if(c[i][q]==c[j][q])t++;
}
if(t>2)
{
da[i]=1;
da[j]=1;
}
}
}
}
void xiaoxie(char c[30])
{
int n=strlen(c),i;
for(i=0; i<n; i++)
{
if(c[i]>='A'&&c[i]<='Z')c[i]+=32;
}
}
int main()
{
int n,i,j;
char c[105][30];
while(~scanf("%d",&n)&&n)
{
j=0;
getchar();
for(i=0; i<n; i++)da[i]=0;
for(i=0; i<n; i++)
{
gets(c[i]);
xiaoxie(c[i]);
}
bijiao(n,c);
for(i=0; i<n; i++)j+=da[i];
printf("%d\n",j);
}
return 0;
}


@执念  "@☆但求“❤”安★
下次我们做的一定会更好。。。。




为什么这次的题目是英文的。。。。QAQ...

计算机学院大学生程序设计竞赛(2015’12)The Country List的更多相关文章

  1. hdu 计算机学院大学生程序设计竞赛(2015’11)

    搬砖 Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65535/65535 K (Java/Others)Total Submissi ...

  2. 计算机学院大学生程序设计竞赛(2015’11)1005 ACM组队安排

    1005 ACM组队安排 Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Pro ...

  3. 计算机学院大学生程序设计竞赛(2015’12)Study Words

    Study Words Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Tota ...

  4. 计算机学院大学生程序设计竞赛(2015’12)Polygon

    Polygon Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Su ...

  5. 计算机学院大学生程序设计竞赛(2015’12) 1008 Study Words

    #include<cstdio> #include<cstring> #include<map> #include<string> #include&l ...

  6. 计算机学院大学生程序设计竞赛(2015’12) 1009 The Magic Tower

    #include<cmath> #include<cstdio> #include<cstring> #include<algorithm> using ...

  7. 计算机学院大学生程序设计竞赛(2015’12) 1006 01 Matrix

    #include<stdio.h> #include<string.h> #include<iostream> #include<algorithm> ...

  8. 计算机学院大学生程序设计竞赛(2015’12) 1003 The collector’s puzzle

    #include<cstdio> #include<algorithm> using namespace std; using namespace std; +; int a[ ...

  9. 计算机学院大学生程序设计竞赛(2015’12) 1004 Happy Value

    #include<cstdio> #include<cstring> #include<cmath> #include<vector> #include ...

随机推荐

  1. 在struts里使用Kindeditor注意事项

    struts配置文件里 <filter-mapping>          <filter-name>struts2</filter-name>          ...

  2. mysql management note

    related url : http://willvvv.iteye.com/blog/1563345 http://lxneng.iteye.com/blog/451985    这篇文章对vari ...

  3. iOS8中用UIVisualEffectView实现高斯模糊视图(毛玻璃效果)

    UIBlurEffect *beffect = [UIBlurEffect effectWithStyle:UIBlurEffectStyleDark]; UIVisualEffectView *vi ...

  4. ADO.net 实体类 、数据访问类

    程序分三层:界面层.业务逻辑层.数据访问层 比较规范的写程序方法,要把业务逻辑层和数据访问层分开,此时需要创建实体类和数据访问类 实体类: 例 using System; using System.C ...

  5. PHP检测用户名是否存在

    reg.php <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www ...

  6. ServiceController1

    using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; usin ...

  7. .NET: WPF Binding对数据的校验和转换以及多路Binding

    一.校验 一般需要对target上的值进行校验. xaml: <Window x:Class="WpfApplication1.MainWindow" xmlns=" ...

  8. Nopi .net下面的Excel第三方dll

    相关参考资料:1.npoi官网:http://npoi.codeplex.com/2.用NPOI操作EXCEL--插入图片:  http://www.cnblogs.com/atao/archive/ ...

  9. oracle 新手遇到常见问题的解决办法

    可能照成以下问题的原因也许有很多种,但是就小白而言,我只记录自己学习过程中遇到的所有的问题.希望对一些新手 小白们有所帮助. 原因是 sys 不是sysdba 用户,你要将其作为sysdba 用户登录 ...

  10. javascript DOM对象

    DOM简介 1.html DOM:当网页被加载时,浏览器会创建页面的文档对象模型(Document Object Model) 2.DOM操作html JS能改变页面中的所有html元素 JS能改变页 ...