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 ...
随机推荐
- springmvc urlpattern配置详解
静态资源无法访问问题的解决方案: 1.使用Tomcat默认的Servlet解决:在web.xml中加以下代码
- 安装nodemon热启动
1.安装: cnpm i nodemon -g 2.执行 nodemon .\launch.js .\config_preview\ .\launch.js 为我要启动的脚本文件 .\config_p ...
- C++中的一类临时对象
类名(参数名)这样的对象是临时对象,不能取地址,不能被引用,不过可以给同类型的其他对象赋值,该临时对象定以后可以进行一次操作,然后立即销毁. 当我们定义一个对象以后并不想立即给它赋初值,而是以后给它赋 ...
- gitlab 添加ssh秘钥
在创建新的ssh秘钥对之前,要先确认一下电脑中是否已经有了一对秘钥: Git Bash on Windows / GNU/Linux / macOS / PowerShell: cat ~/.ssh/ ...
- php学习笔记-return语句
一个函数中可以有return语句,也可以没有.什么时候需要呢?就是当你想接收函数的执行结果的时候,你需要一个return 语句. 函数执行完return语句之后,return语句后面的代码是永远不会得 ...
- java全栈day04--方法
day04内容介绍 1 方法基础知识 2 方法高级内容 3 方法案例 一 方法的概念 A:为什么要有方法 提高代码的复用性 B 什么是方法 完成特定功能的代码块 修饰符 返回值类型 方 ...
- ListBox 光标如何定位在最后一行 显示
richTextBox_show.SelectionStart = richTextBox_show.Text.Length - 1; richTextBox_show.Focus();
- DingTalk代码库机器人尝试
今日室友询问相关机器人的事情,本来对于机器人还是有一些了解的,至少是明白一些简单的原理,包括微信公众号,qq群的只能机器人,以及钉钉的机器人. 首先是说那个关于微信公众号的那个自动回复便可以使用一些机 ...
- Java50道经典习题-程序32 左移右移
题目:取一个整数a从右端开始的4-7位.分析:比如取123456789从右端开始的4-7位即:3456(1)先使a右移4位.(2)设置一个低4位全为1,其余全为0的数.可用~(~0<<4) ...
- InnoDB记录压缩及使用分析
此文已由作者温正湖授权网易云社区发布. 欢迎访问网易云社区,了解更多网易技术产品运营经验. 这篇文章,源于RDS组内的一次饭后闲聊,两位小伙伴在探讨InnoDB启用压缩后的种种,比如在磁盘上是怎么存放 ...