Computer College Undergraduate Program Design Contest (2015 ') the Country List

Source: Internet
Author: User
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 World Expo hosted by Shanghai was coming, CC is very honorable to being a volunteer of such an International pageant. The He job is to guide the foreign visitors. Although he has a strong desire to be a excellent volunteer, the lack of 中文版 makes him for a long.
Some countries ' names look so similar the 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 to each word, CC Cannot distinguish them. For Example:albania and Algeria have the same length 7, and their A, second, sixth and seventh letters are. So CC can ' t distinguish them.
Now he has received a name list of countries, please tell him how many words the 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 < m) 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 would not exceed 20.
You can assume that no name would 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 4 Aaaa Abaa Cbaa Cbad
Sample Output
2 4


Always looking at once space in a daze, those who say not separate friends, turn around, strangers. Familiar, quiet, quiet, left, left, unfamiliar, unfamiliar, disappeared, disappeared, strangers.

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


@ hold read "@☆ but beg" ❤ "Ann ★ Next time we do will be better ....
for what this time the topic is in English .... Qaq ...

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.