uvaoj 620 - Cellular Structure(题意好难理解)

给了一个细胞链,细胞只有A和B两种,细胞链有几种生长的方式,看看给定的一个细胞链是否是通过这几种方式得到的,要求给出现在所处的状态。
我刚开始也是这样想的,但是没想到偶数就直接是最后一种情况,看了看网上的代码,不过还是有点儿懵。
代码如下:
/*************************************************************************
	> File Name: 620.cpp
	> Author: gwq
	> Mail: gwq5210@qq.com 
	> Created Time: 2014年12月19日 星期五 22时07分24秒
 ************************************************************************/

#include <cmath>
#include <ctime>
#include <cctype>
#include <climits>
#include <cstdio>
#include <cstdlib>
#include <cstring>

#include <map>
#include <set>
#include <queue>
#include <stack>
#include <string>
#include <vector>
#include <sstream>
#include <iostream>
#include <algorithm>

#define INF (INT_MAX / 10)
#define clr(arr, val) memset(arr, val, sizeof(arr))
#define pb push_back
#define sz(a) ((int)(a).size())

using namespace std;
typedef set<int> si;
typedef vector<int> vi;
typedef map<int, int> mii;
typedef long long ll;

const double esp = 1e-5;

#define N 10000

char str[N];
char ans[][20] = {"SIMPLE", "FULLY-GROWN", "MUTAGENIC", "MUTANT"};

int main(int argc, char *argv[])
{
	int t;
	scanf("%d", &t);
	while (t--) {
		scanf("%s", str);
		int len = strlen(str);
		if (len % 2 == 0) {
			printf("%s\n", ans[3]);
			continue;
		}
		if (len == 1 && str[0] == 'A') {
			printf("%s\n", ans[0]);
		} else if (len >= 2 && str[len - 2] == 'A' && str[len - 1] == 'B') {
			printf("%s\n", ans[1]);
		} else if (str[0] == 'B' && str[len - 1] == 'A') {
			printf("%s\n", ans[2]);
		} else {
			printf("%s\n", ans[3]);
		}
	}

	return 0;
}


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值