ural 1433. Diamonds
2024-10-30 21:19:25
1433. Diamonds
Time limit: 1.0 second
Memory limit: 64 MB
Memory limit: 64 MB
Sasha is lucky to have a diamond in the form of a regular tetrahedron. Incidentally, his friend Pasha has got a diamond of exactly the same shape and size. In order to distinguish between their diamonds, the friends decided to paint the crystals. Each of them painted each face of his diamond a certain color. The diamonds became very beautiful, so Pasha and Sasha were happy. But their happiness did not last long. That night, Sasha woke up with a sudden thought — what if his and Pasha's diamonds are still indistinguishable? He decided to call Pahsa immediately. Sasha ran up to the phone, tried to grasp the receiver, but at that moment the phone rang. Of course, it was Pasha, who had the same sudden thought. So Sasha and Pasha hastened to tell each other the colors of their diamonds' faces… Their worst fears were confirmed. Their diamonds were identical, and to see it one simply had to turn one of the diamonds.
You are to write a program that could prevent this horrible mistake. Given a scheme of the supposed coloring of the diamonds, determine if these colorings are identical, i.e., if one of them can be obtained from the other by turning the crystal.
Input
The input contains two lines. Each line contains four letters, which denote the colors of the faces in the following order: the base face, the "left front" face, the "right front" face, and the back face. There are only four paints available: red, green, blue, and yellow, denoted by the letters R, G, B, and Y, respectively.
Output
Output the word "equal" if the colored tetrahedrons will be identical, and the word "different" otherwise.
Sample
input | output |
---|---|
RGRB |
equal |
Problem Author: Pavel Egorov, Stanislav Vasilyev
Problem Source: The 7th USU Open Personal Contest - February 25, 2006
Problem Source: The 7th USU Open Personal Contest - February 25, 2006
Tags: none (hide tags for unsolved problems)
Difficulty: 252
题意:给两个正四面的的四个面的颜色,判断两个四面体是否相等。
分析:所以我们只要将所有匹对方式打个表就好。
/**
Create By yzx - stupidboy
*/
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <deque>
#include <vector>
#include <queue>
#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <ctime>
#include <iomanip>
using namespace std;
typedef long long LL;
typedef double DB;
#define For(i, s, t) for(int i = (s); i <= (t); i++)
#define Ford(i, s, t) for(int i = (s); i >= (t); i--)
#define Rep(i, t) for(int i = (0); i < (t); i++)
#define Repn(i, t) for(int i = ((t)-1); i >= (0); i--)
#define rep(i, x, t) for(int i = (x); i < (t); i++)
#define MIT (2147483647)
#define INF (1000000001)
#define MLL (1000000000000000001LL)
#define sz(x) ((int) (x).size())
#define clr(x, y) memset(x, y, sizeof(x))
#define puf push_front
#define pub push_back
#define pof pop_front
#define pob pop_back
#define ft first
#define sd second
#define mk make_pair
inline void SetIO(string Name)
{
string Input = Name+".in",
Output = Name+".out";
freopen(Input.c_str(), "r", stdin),
freopen(Output.c_str(), "w", stdout);
} inline int Getint()
{
int Ret = ;
char Ch = ' ';
bool Flag = ;
while(!(Ch >= '' && Ch <= ''))
{
if(Ch == '-') Flag ^= ;
Ch = getchar();
}
while(Ch >= '' && Ch <= '')
{
Ret = Ret * + Ch - '';
Ch = getchar();
}
return Flag ? -Ret : Ret;
} const int N = , M = ;
int Face[][]={
{, , , }, {, , , }, {, , , },
{, , , }, {, , , }, {, , , },
{, , , }, {, , , }, {, , , },
{, , , }, {, , , }, {, , , }
};
struct Node
{
int Arr[];
inline void Read()
{
string Str;
cin >> Str;
Rep(i, ) Arr[i] = Str[i];
}
} A, B; inline void Input()
{
A.Read();
B.Read();
} inline void Solve()
{
Rep(i, )
{
bool Flag = ;
Rep(j, )
if(A.Arr[Face[i][j]] != B.Arr[j])
{
Flag = ;
break;
}
if(!Flag)
{
puts("equal");
return;
}
}
puts("different");
} int main()
{
#ifndef ONLINE_JUDGE
SetIO("B");
#endif
Input();
Solve();
return ;
}
最新文章
- SQLite 的创建与编辑
- firefox 下event事件失效的解决方法
- Web应用程序系统的多用户权限控制设计及实现-权限模块【10】
- sdutoj 2608 Alice and Bob
- 【Android】Handler、Looper源码分析
- PHP中的抽象类和接口
- Entity Framework 6.1 学习系列1--概况、安装
- PHP foreach()跳出本次或当前循环与终止循环方法
- 分享一个自己写的基于JQuery的一个Web背景切换的Demo
- Apache HTTP Server
- vs2013 linq to mysql
- Google HTML/CSS 编码规范
- NodeJs之crypto
- 控制结构(8) 线性化(linearization)
- [Swift]LeetCode248.对称数 III $ Strobogrammatic Number III
- Spring AOP @AspectJ 入门基础
- BZOJ 2173 luoguo P4451 [国家集训队]整数的lqp拆分
- Codeforces 960D - Full Binary Tree Queries
- 随机取出数组中的某些值,并删除它们array_splice,array_slice
- oracle之 变更OS时间对数据库的影响