2015'12杭电新生赛1001 The Country List
来源:互联网 发布:js抛物线添加到购物车 编辑:程序博客网 时间:2024/06/09 17:30
题解:
水题不解释
代码
#include <bits/stdc++.h>#include <cstdio>#include <queue>#include <cstring>#include <iostream>#include <cstdlib>#include <algorithm>#include <vector>#include <map>#include <set>#include <ctime>#include <cmath>#include <cctype>#include <string>#include <bitset>#define MAX 100000#define LL long longusing namespace std;int cas=1,T,n;char word[110][30];int cmp(int x,int y){ int sum=0; for(int i=0;word[x][i]&&word[y][i];i++) if(tolower(word[x][i])==tolower(word[y][i])) sum++; return sum;}int vis[110];int main(){ //freopen("in","r",stdin); //scanf("%d",&T); while(scanf("%d",&n)!=EOF) { for(int i=0;i<n;i++) scanf("%s",word[i]); memset(vis,0,sizeof(vis)); for(int i=0;i<n;i++) for(int j=i+1;j<n;j++) { if(strlen(word[i])==strlen(word[j])&&cmp(i,j)>2) vis[i]=vis[j]=1; } int countt=0; for(int i=0;i<n;i++) if(vis[i]) countt++; printf("%d\n",countt); } return 0;}
题目
The Country List
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
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杭电新生赛1001 The Country List
- The Country List(杭电12月比赛)
- 【杭电2015年12月校赛A】【水题 暴力】The Country List 多少个名字与其它名字more than 2位置字符相同
- 计算机学院大学生程序设计竞赛(2015’12)1001 The Country List
- 2015杭电新生赛1001搬砖【dfs】
- 杭电2017新生赛1001-考研
- 2017杭电新生赛 1001~1009
- hdu 计算机学院大学生程序设计竞赛(2015’12)The Country List
- 计算机学院大学生程序设计竞赛(2015’12)The Country List
- 计算机学院大学生程序设计竞赛(2015’12)The Country List(水题)
- 2015杭电新生赛1008游乐场【神坑】
- 2015杭电新生赛1003玩骰子【大型模拟】
- 2015杭电新生赛1004质方数【打素数表】
- 杭电新生赛(1005)
- 2015杭电新生赛1005ACM组队安排【排列组合】【智商题】
- 2015杭电新生赛1002投币洗衣机【水模拟】
- 2015杭电新生赛1007油菜花王国【并查集】【图论】
- 杭电2017新生赛1007-找方块
- weblogic开发模式与生产模式
- android框架--xUtils
- Linux信号处理机制原理
- Gavua 之 cache
- 获取当前系统桌面路径(C# 代码)
- 2015'12杭电新生赛1001 The Country List
- HMaster分析之Region的负载均衡实现(一)
- 安卓网络编程(一)网络编程概述
- poj3660
- 微信朋友圈技术之道:三个人的后台团队与每日十亿的发布量
- Oracle误删除数据恢复
- 网络编程2
- Some OJ
- A. Pasha and Stick