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. 定时器 NSTimer 和 CADisplayLink

    NSTimer *timer; CADisplayLink *caDisplayLink; int timeCount; - (void)viewDidLoad { [super viewDidLoa ...

  2. 《30天自制操作系统》10_day_学习笔记

    harib07a: 整理内存管理函数:memman_alloc和memman_free能够以最小1字节进行内存管理,但时间久了后,容易产生外部碎片:为此,笔者编写了一些以0x1000字节为单位进行内存 ...

  3. maven增加Spring

    对于javax.annotation,spring某些注解要用的,比如:@Resource.   使用Maven管理基本的Spring依赖关系 Spring被设计为可高度模块化的 —— 使用Sprin ...

  4. 我写了本破书-swift语言实战晋级

    本书是一本介绍Swift实战的实用图书,旨在帮有一定编程基础的童鞋能够快速上手Swift. 本书的结构是先讲解了Swift语言的精要,没有基础的童鞋可以学习,有基础的童鞋可以当做复习. 接着讲解如何用 ...

  5. Groupon面经Prepare: Max Cycle Length

    题目是遇到偶数/2,遇到奇数 *3 + 1的题目,然后找一个range内所有数字的max cycle length.对于一个数字,比如说44,按照题目的公式不停计算,过程是 44, 22, 11, 8 ...

  6. C#删除xml中某个节点的子节点方法

    if (File.Exists(xmlFilePath)) { XmlDocument xmlDoc = new XmlDocument(); xmlDoc.Load(xmlFilePath); Xm ...

  7. Andriod环境搭建

    安卓是一款现在在移动端十分流行的系统,本人出于好奇心,希望彻底了解安卓的开发技. 首先了解一下安卓的系统构架,安卓大致分为四层架构,五块区域: 1.Linux内核层 Andriod是基于Linux2. ...

  8. demo02TextView

    main.xml----- /layout/activity_main.xml <RelativeLayout xmlns:android="http://schemas.androi ...

  9. kafka 0.8.x producer Example(scala)

    Producer 最简配置 metadata.broker.list参数指定broker地址,这里不需要填上所有的broker地址,但是如果只写一个,这个broker挂掉后就无法往topic中写入信息 ...

  10. C# 文件读取(一)

    1. 读写文件的步骤: 创建一个文件流 -- 创建相应的读写器 -- 执行读写操作 -- 关闭读写器 -- 关闭文件流 创建一个文件流:   FileStream objfs = new FileSt ...