您的位置:首页 > 大数据 > 人工智能

算法竞赛入门经典第四章习题4-4 Cube painting UVA - 253

2018-01-05 00:11 363 查看
习题4-4

https://vjudge.net/problem/UVA-253

#include<iostream>
#include<string>
#include<cstring>
#pragma warning(disable:4996)
using namespace std;

int main() {
#ifdef _DEBUG
//freopen("in", "rb", stdin);
//freopen("out", "wb", stdout);
#endif // _DEBUG
string A[24] = { "123456","135246","154326","142536",
"214365","246135","263415","231645",
"312564","326154","365214","351624",
"421653","415263","456123","462513",
"513462","536142","564312","541632",
"624351","645231","653421","632541" };
string s, t;
while (cin >> s) {
bool is_true=false;
t = string(s, 0, 6);
s = string(s, 6, 12);
for (int i = 0; i < 24; ++i) {
is_true = true;
for(int j=0;j<6;++j)
if (t[j] != s[A[i][j] - '1']) {
is_true = false; break;
}
if (is_true) break;
}
if (is_true) cout << "TRUE" << endl;
else cout << "FALSE" << endl;
}
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: