Looking for clones.

Source: Internet
Author: User

To find the time limit for a cloned person: +Ms | Memory Limit:65535KB Difficulty:3
Describe

A small town in the United States was recently attacked by aliens and some residents were taken away and cloned, and now scientists have extracted DNA from some people in the town, identifying the number of DNA with the same number of clones, such as the following 9 sequences

Aaaaaa
Acacac
Gttttg
Acacac
Gttttg
Acacac
Acacac
Tccccc
Tccccc
Where TCCCCC,GTTTTG have two identical individuals, ACACAC have four, aaaaaa is one, then the number of rows corresponding to the output

First row 1, second row 2, fourth row 1, other row output 0, total 9 rows

Input
number of sequences not exceeding 20000, no more than 20 characters per sequence
Input ends at 0 0
Output
the output can be described in title
Sample input
9 6AAAAAAACACACGTTTTGACACACGTTTTGACACACACACACTCCCCCTCCCCC0 0
Sample output
120100000
 code: 
#include <stdio.h> #include <stdlib.h> #include <string.h>int cmp (const void *a,const void *b) {return ( strcmp ((char*) A, (char*) b)); int main () {int M,n,i,num[20005];char str[20002][21];while (scanf ("%d%d", &m,&n)!=eof&&m!=0& &n!=0) {for (i=0;i<m;i++) scanf ("%s", Str[i]), Qsort (str,m,sizeof (str[0)), CMP), memset (num,0,sizeof (num)); int Count=1;for (i=1;i<=m;i++) {if (strcmp (str[i],str[i-1]) ==0) count++;else{num[count]++;count=1;}} for (i=1;i<=m;i++) printf ("%d\n", Num[i]);} return 0;}


Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

Looking for clones.

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.