HBC24710阶乘尾数[USACO 2010 Jan B]DNA Sequencing题解

一沫阳光 算法基础篇 27 0
挑战自我,勇攀编程高峰!全网最全C++题库,助您成为编程达人。
Farmer John is studying the geneology of his herd. He has M bulls (1

Farmer John is studying the geneology of his herd. He has M bulls (1 <= M <= 20) and F cows (1 <= F <= 20). He doesn't know, though, which bovines are potential descendants of which other bovines. Farmer John does know the unique DNA sequence DNA_i DNA i ​  of each and every cow and bull on his farm. DNA_i DNA i ​ has length 25 characters and contains only upper-case letters 'A', 'C', 'G', and 'T'. He wants to determine which bovines could possibly be children of which pairs of cows and bulls. Help Farmer John make this determination. For each pair of a cow and a bull, print how many of FJ's other bovines could possibly be their children. A bovine can be a child of a given cow and bull if (1) it is not either of its parents (that is, a cow cannot be its own mother and a bull cannot be its own father) (2) each position in its DNA sequence matches at least one of the characters in the same position in the two parent sequences So for example, 'abc' could come from pair ('axx', 'xbc'), but not from the pair ('aaa', 'bbb'). Consider three bulls and two cows with these DNA sequences: Bull 1: GTTTTTTTTTTTTTTTTTTTTTTTT Bull 2: AATTTTTTTTTTTTTTTTTTTTTTT Bull 3: GATTTTTTTTTTTTTTTTTTTTTTT Cow 1: TTTTTTTTTTTTTTTTTTTTTTTTT Cow 2: ATTTTTTTTTTTTTTTTTTTTTTTT Bull 2 and cow 1 could be the parents of cow 2: Bull 2: AATTTTTTTTTTTTTTTTTTTTTTT Cow 1: TTTTTTTTTTTTTTTTTTTTTTTTT Cow 2: ATTTTTTTTTTTTTTTTTTTTTTTT since cow 2's first letter 'A' could be from Bull 2; cow 2's second letter 'T' could come from cow 1; the remainder of the letters could come from either parent. Your goal is to create a matrix of the count of possible offspring of each pairing of bulls and cows.

HBC24710阶乘尾数[USACO 2010 Jan B]DNA Sequencing题解
-第1张图片-东莞河马信息技术
(图片来源网络,侵删)
成为编程大师,不再是梦想!全网最全C++题库,助您开启编程新篇章。

标签: HBC24710阶乘尾数[USACO 2010 Jan B]DNA Sequencing题解