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
  1. 3
  2. Denmark
  3. GERMANY
  4. China
  5. 4
  6. Aaaa
  7. aBaa
  8. cBaa
  9. cBad
 
Sample Output
  1. 2
  2. 4
 

总是望着曾经的空间发呆,那些说好不分开的朋友不在了,转身,陌路。 熟悉的,安静了, 安静的,离开了, 离开的,陌生了, 陌生的,消失了, 消失的,陌路了。

  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <string.h>
  4. int da[105]= {0};
  5. void bijiao(int n,char c[105][30])
  6. {
  7. int i,j,t=0,q;
  8. for(i=0; i<n; i++)
  9. for(j=0; j<n; j++)
  10. {
  11. t=0;
  12. if(strcmp(c[i],c[j])==0)continue;
  13. if(strlen(c[i])==strlen(c[j]))
  14. {
  15. for(q=0; q<(int)strlen(c[i]); q++)
  16. {
  17. if(c[i][q]==c[j][q])t++;
  18. }
  19. if(t>2)
  20. {
  21. da[i]=1;
  22. da[j]=1;
  23. }
  24. }
  25. }
  26. }
  27. void xiaoxie(char c[30])
  28. {
  29. int n=strlen(c),i;
  30. for(i=0; i<n; i++)
  31. {
  32. if(c[i]>='A'&&c[i]<='Z')c[i]+=32;
  33. }
  34. }
  35. int main()
  36. {
  37. int n,i,j;
  38. char c[105][30];
  39. while(~scanf("%d",&n)&&n)
  40. {
  41. j=0;
  42. getchar();
  43. for(i=0; i<n; i++)da[i]=0;
  44. for(i=0; i<n; i++)
  45. {
  46. gets(c[i]);
  47. xiaoxie(c[i]);
  48. }
  49. bijiao(n,c);
  50. for(i=0; i<n; i++)j+=da[i];
  51. printf("%d\n",j);
  52. }
  53. return 0;
  54. }


@执念  "@☆但求“❤”安★
下次我们做的一定会更好。。。。




为什么这次的题目是英文的。。。。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. jquery对strutrs2 <s:radio>标签的设置和取值

    今天郁闷了1小时. 需求是这样的: <s:radio  list="#{0:'男',1:'女'}" value="member.sex" id=" ...

  2. Xcode 遇到 App Transport Security has blocked a cleartext HTTP 错误

    今天用Xcode  创建新项目用到 URL 发送请求时,报下面的错: “App Transport Security has blocked a cleartext HTTP (http://) re ...

  3. IOS 设备参数

    Iphone,Ipad,ITouch 各个型号参数对比

  4. Dropbox能火,为何它的中国同行不能火?

    http://tech.163.com/15/0510/11/AP8II63H000915BF.html Dropbox能火,为何它的中国同行不能火? 2015-05-10 11:33:55 来源:  ...

  5. hduoj 4715 Difference Between Primes 2013 ACM/ICPC Asia Regional Online —— Warmup

    http://acm.hdu.edu.cn/showproblem.php?pid=4715 Difference Between Primes Time Limit: 2000/1000 MS (J ...

  6. 0422 数学口袋精灵app

    首先要部署这个app项目就是第一步: 一.前提下载并安装JDK 在线图解:手把手教你安装JDK      http://www.lvtao.net/server/windows-setup-jdk.h ...

  7. Spark on Yarn

    Spark on Yarn 1. Spark on Yarn模式优点 与其他计算框架共享集群资源(eg.Spark框架与MapReduce框架同时运行,如果不用Yarn进行资源分配,MapReduce ...

  8. 动态LOV语句、向具有LOV的ITEM赋值时报FRM-40212需要验证错误

    网上解决方法: http://www.itpub.net/thread-845812-2-1.html http://blog.csdn.net/rfb0204421/article/details/ ...

  9. django templates学习使用记录

    可以在基本模板中多插入几个black来适应不同的布局

  10. JavaSPI机制学习笔记

    最近在阅读框架源代码时,常常看到 SPI 的子包, 忍不住查了下: Service Provider Interface : 服务提供接口. JavaSPI 实际上是“基于接口的编程+策略模式+配置文 ...