uva 253(数学)

题解:只要保证两个正方体对面的颜色对应就可以了,比如rbgggrrggbgr第一个正方体对面颜色分别是rr bg gg, 第二个正方体对面颜色分别是rr, gg, gb,只要这两组数据都一一对应,字母相同,顺序可以不相同,就是true,否则false.
#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
using namespace std;

int main() {
	string s, str[3], temp, temp1;
	int i, flag;
	while (getline(cin, s)) {
		for (i = 0; i < 3; i++)
			str[i] = "";
		str[0] += s[0];
		str[1] += s[1];
		str[2] += s[2];
		str[0] += s[5];
		str[1] += s[4];
		str[2] += s[3];
		temp = temp1 = "";
		temp += s[6];
		temp += s[11];
		temp1 += s[11];
		temp1 += s[6];
		for (i = 0; i < 3; i++)
			if (temp == str[i] || temp1 == str[i]) {
				str[i] = "\0";
				break;
			}
		if (i == 3) {
			printf("FALSE\n");
			continue;
		}
		temp = temp1 = "";
		temp += s[7];
		temp += s[10];
		temp1 += s[10];
		temp1 += s[7];
		for (i = 0; i < 3; i++)
			if (temp1 == str[i] || temp == str[i]) {
				str[i] = "\0";
				break;
			}
		if (i == 3) {
			printf("FALSE\n");
			continue;
		}
		temp = temp1 = "";
		temp += s[8];
		temp += s[9];
		temp1 += s[9];
		temp1 += s[8];
		for (i = 0; i < 3; i++)
			if (temp1 == str[i] || temp == str[i])
				break;
		if (i == 3) {
			printf("FALSE\n");
			continue;
		}
		printf("TRUE\n");
	}
	return 0;
}


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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值