HDU计算机学院大学生程序设计竞赛(2015’12)The Country List
Problem Description
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.
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.
#include<stdio.h>
//#include<bits/stdc++.h>
#include<string.h>
#include<iostream>
#include<math.h>
#include<sstream>
#include<set>
#include<queue>
#include<map>
#include<vector>
#include<algorithm>
#include<limits.h>
#define inf 0x3fffffff
#define INF 0x3f3f3f3f
#define lson l,m,rt<<1
#define rson m+1,r,rt<<1|1
#define LL long long
#define ULL unsigned long long
using namespace std;
int n;
string ss[100];
set<string> q;
int main ()
{
while(cin>>n)
{
int i,j;
for(i=0; i<n; i++)
{
cin>>ss[i];
}
for(i=0; i<n; i++)
{
for(j=0; j<n; j++)
{
int sum=0;
if(i==j) continue;
if(ss[i].length()==ss[j].length())
{
for(int z=0; z<ss[i].length(); z++)
{
if(ss[i][z]==ss[j][z]||abs(ss[i][z]-ss[j][z])==32)
{
sum++;
}
}
if(sum>2)
{
// cout<<ss[i]<<" "<<ss[j]<<endl;
q.insert(ss[j]);
}
} }
}
cout<<q.size()<<endl;
q.clear();
}
return 0;
}
HDU计算机学院大学生程序设计竞赛(2015’12)The Country List的更多相关文章
- hdu 计算机学院大学生程序设计竞赛(2015’11)
搬砖 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65535/65535 K (Java/Others)Total Submissi ...
- HDU计算机学院大学生程序设计竞赛(2015’12)Happy Value
Problem Description In an apartment, there are N residents. The Internet Service Provider (ISP) want ...
- HDU计算机学院大学生程序设计竞赛(2015’12)The Magic Tower
Problem Description Like most of the RPG (role play game), “The Magic Tower” is a game about how a w ...
- 计算机学院大学生程序设计竞赛(2015’11)1005 ACM组队安排
1005 ACM组队安排 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Pro ...
- 计算机学院大学生程序设计竞赛(2015’12)Study Words
Study Words Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Tota ...
- 计算机学院大学生程序设计竞赛(2015’12)Polygon
Polygon Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Su ...
- 计算机学院大学生程序设计竞赛(2015’12)The Country List
The Country List Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) ...
- 计算机学院大学生程序设计竞赛(2015’12) 1008 Study Words
#include<cstdio> #include<cstring> #include<map> #include<string> #include&l ...
- 计算机学院大学生程序设计竞赛(2015’12) 1009 The Magic Tower
#include<cmath> #include<cstdio> #include<cstring> #include<algorithm> using ...
随机推荐
- 解决iText+freemark导出pdf不支持base64的解决办法
工具类: package test; import java.io.IOException ; import org.w3c.dom.Element ; import org.xhtmlrendere ...
- 恢复oracle的回收站的所有的表
使用sys as sysdba 进入到sqlplus的控制界面 sqlplus / as sysdba 执行相关的命令,自动生成一个脚本文件 spool d:/a.sql select 'flashb ...
- ubuntu16.04 安装caffe2
1.使用conda创建环境 conda create --name caffe2env python=3.6 ---------------------------------success----- ...
- 解决校园Dr客户端端口占用问题(2)
win + R -> 输入cmd回车 -> 输入netsh winsock reset重启 -> 好了享受上网的快乐吧骚年
- 算法Sedgewick第四版-第1章基础-2.1Elementary Sortss-001选择排序法(Selection sort)
一.介绍 1.算法的时间和空间间复杂度 2.特点 Running time is insensitive to input. The process of finding the smallest i ...
- CLRInjection - 通用托管注入(超级灰色按钮克星升级版)
通用托管注入 - CLRInjection CLR软件系列第二发: 通用托管注入 - CLRInjection 软件简介:这款软件可以将任意托管DLL用插件的形式,注入到正在运行中的.net托管程序集 ...
- Entity Framework Tutorial Basics(33):Spatial Data type support in Entity Framework 5.0
Spatial Data type support in Entity Framework 5.0 MS SQL Server 2008 introduced two spatial data typ ...
- 关于Spring注解配置的步骤
今天分享一下 关于Spring注解配置的流程 1 导包:如下图所示 2 书写User和Car类 代码如下 package cn.lijun.bean; public class Car { priv ...
- KMS激活工具
工具介绍 KMS_VL_ALL,国外MDL论坛的一款KMS激活工具,可自动识别需要激活的Windows以及Office的VL版本,无需联网即可全自动检测激活,支持创建自动续期计划,相比于国外的同类工具 ...
- docker网络模式----入门docker的难点
众所周知,现在docker是轻量级虚拟化的典型代表!这段时间想要建立一个分布式系统,但是手头上主机没那么多,所以使用docker进行虚拟化,但是在使用的过程中对网络这一部分是一直不太理解,特别找了一篇 ...