计算机学院大学生程序设计竞赛(2015’12)The Country List

时间:2023-01-16 00:16:51

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
 

总是望着曾经的空间发呆,那些说好不分开的朋友不在了,转身,陌路。 熟悉的,安静了, 安静的,离开了, 离开的,陌生了, 陌生的,消失了, 消失的,陌路了。计算机学院大学生程序设计竞赛(2015’12)The Country List

#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;
}


@执念  "@☆但求“❤”安★
下次我们做的一定会更好。。。。计算机学院大学生程序设计竞赛(2015’12)The Country List




为什么这次的题目是英文的。。。。QAQ...计算机学院大学生程序设计竞赛(2015’12)The Country List

计算机学院大学生程序设计竞赛(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. linux 下安装tomcat

    1.把安装包放到 tomcat的目录, 2.然后  解压  tar -zxvf apache-tomcat-7.0.70.tar.gz    解压. 3.然后启动tomcat

  2. &lbrack;转&rsqb;GeoHash核心原理解析

    原文出处: zhanlijun    引子 机机是个好动又好学的孩子,平日里就喜欢拿着手机地图点点按按来查询一些好玩的东西.某一天机机到北海公园游玩,肚肚饿了,于是乎打开手机地图,搜索北海公园附近的餐 ...

  3. c&num; 读取IntPtr 中的数据 z

    c++的写法是这样的: LRESULT CPictureQueryDlg::OnQueryPicNty(WPARAM wp, LPARAM lp) { EnableWindow(TRUE); BYTE ...

  4. cocos2d-x 节点操作 --&gt&semi;J2ME

      cocos2d-x 的节点操作涉及到以下几点          1.  节点之间的关系          2.  节点的添加操作          3.  节点的删除操作          4.  ...

  5. uvaoj 10397 - Connect the Campus【最小生成树】

    uvaoj 10397 - Connect the Campus Many new buildings are under construction on the campus of the Univ ...

  6. AsyncTask究竟需要多少个线程

    最起码两个:主线程和工作线程; 可以参考:http://zhidao.baidu.com/link?url=ho4UEcEbaogRZUFHwig1neSKR25b2zT9iXyM36hEgWTmvJ ...

  7. 【小练习04】HTML&plus;CSS--医药健康小页面

    要求实现如下效果图: 代码演示 <!DOCTYPE html> <html> <head> <meta charset="UTF-8"&g ...

  8. ArrayList、Vector、LinkedList、HashMap、HashTable的存储性能和特性

    ArrayList和Vector都是使用数组方式存储数据,次数组元素大于实际存储的数据以便添加和插入元素,它们都允许直接按序号索引元素,但是插入元素要涉及数组元素移动等内存操作,所以索引数据快而插入数 ...

  9. 【API调用】腾讯云短信

    在之前介绍的火车票查询工具中,利用邮件和短信将查询结果推送给用户.免费短信的条数只有5条,用完之后只能单独使用邮件提醒. 最近发现腾讯云的福利,简单的介绍一下用法. 腾讯云->产品->通信 ...

  10. Element-UI标签页el-tabs组件的拖动排序实现

    ElementUI的标签页组件支持动态添加删除,如下图: 但是这个组件不支持标签之间的拖动排序.那么我们自己怎样实现这个功能呢? 有一个叫vuedraggable的组件(https://github. ...