Question, two types of cells B. A can generate a non-empty cell chain from empty cells. If there are two ways to increase the value of O to the original non-empty cell chain, then o can grow to the OAB or BOA to give you a cell chain. it is a legal split requirement to determine which method of the last split is unable to obtain the output mutant.
If the given S end with AB, judge whether the part of AB is removed. If S is B, then judge whether the end of a is removed;
#include <cstdio> #include <cstring> char s[10000]; bool dp(int i, int j) { if (i == j) return s[i] == 'A' ? 1 : 0; else if (s[j - 1] == 'A' && s[j] == 'B') return dp(i, j - 2); else if (s[i] == 'B' && s[j] == 'A') return dp(i + 1, j - 1); return 0; } int main() { int t; scanf("%d", &t); while (t--) { scanf("%s", s + 1); int l = strlen(s + 1); if (!strcmp(s, "A")) printf("SIMPLE\n"); else if (s[l - 1] == 'A' && s[l] == 'B' && dp(1, l - 2)) printf("FULLY-GROWN\n"); else if (s[1] == 'B' && s[l] == 'A' && dp(2, l - 1)) printf("MUTAGENIC\n"); else printf("MUTANT\n"); } return 0; }
A chain of connected cells of two types A and B composes a cellular structure of some microorganisms of species apudotdls.
If no mutation had happened during growth of an organism, its cellular chain wocould take one of the following forms:
simple stage O = A fully-grown stage O = OAB mutagenic stage O = BOA
Sample notation o = OA means that if we added to chain of a healthy organism a cell a from the right hand side, we wocould end up also with a chain of a healthy organism. it wocould grow by one cell.
A laboratory researches a cluster of these organisms. Your task is to write a program which cocould find out a current stage of growth and health of an organism, given its cellular chain sequence.
Input
A integerNBeing a number of cellular chains to test, and thenNConsecutive lines containing chains of tested organisms.
Output
For each tested chain give (in separate lines) proper answers:
SIMPLE for simple stage FULLY-GROWN for fully-grown stage MUTAGENIC for mutagenic stage MUTANT any other (in case of mutated organisms)
If an organism were in two stages of growth at the same time the first option from the list above shocould be given as an answer.
Sample Input
4AAABBAABBAABA
Sample output
SIMPLEFULLY-GROWNMUTANTMUTAGENIC
Ultraviolet A 620 cellular structure (DP)