CF98A.Help Victoria the Wise
普及+/提高
通过率:0%
时间限制:1.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
Vasilisa the Wise from a far away kingdom got a present from her friend Helga the Wise from a farther away kingdom. The present is a surprise box, yet Vasilisa the Wise doesn't know yet what the surprise actually is because she cannot open the box. She hopes that you can help her in that.
The box's lock is constructed like that. The box itself is represented by an absolutely perfect black cube with the identical deepening on each face (those are some foreign nanotechnologies that the far away kingdom scientists haven't dreamt of). The box is accompanied by six gems whose form matches the deepenings in the box's faces. The box can only be opened after it is correctly decorated by the gems, that is, when each deepening contains exactly one gem. Two ways of decorating the box are considered the same if they can be obtained one from the other one by arbitrarily rotating the box (note that the box is represented by a perfect nanotechnological cube)
Now Vasilisa the Wise wants to know by the given set of colors the following: in how many ways would she decorate the box in the worst case to open it? To answer this question it is useful to know that two gems of one color are indistinguishable from each other. Help Vasilisa to solve this challenging problem.
来自遥远王国的智者瓦西丽莎,收到了来自更遥远王国的智者赫尔加赠送的一份礼物。这份礼物是一个惊喜盒子,但瓦西丽莎尚不清楚其中的惊喜究竟是什么,因为她还无法打开这个盒子。她希望你能在这方面助她一臂之力。
该盒子的锁结构如下:盒子本身是一个绝对完美的黑色立方体,其六个面上各有一个完全相同的凹槽(这些是远方王国的科学家们连做梦都未曾想到的某种外国纳米技术)。盒子附带六颗宝石,其形状恰好与盒子各面上的凹槽相匹配。只有当盒子被宝石正确装饰后——即每个凹槽中恰好嵌入一颗宝石——盒子才能被打开。若两种装饰方式可通过任意旋转盒子而相互得到,则视为同一种装饰方式(注意:该盒子是一个完美的纳米技术立方体)。
现在,瓦西丽莎想知道:给定一组宝石颜色,在最坏情况下,她需要尝试多少种不同的装饰方式才能打开盒子?要回答这个问题,需注意:同色的两颗宝石彼此不可区分。请帮助瓦西丽莎解决这一富有挑战性的问题。
输入格式
The first line contains exactly 6 characters without spaces from the set {R, O, Y, G, B, V} — they are the colors of gems with which the box should be decorated.
第一行包含恰好 6 个无空格的字符,取自集合 {R, O, Y, G, B, V} —— 它们是用于装饰盒子的宝石的颜色。
输出格式
Print the required number of different ways to decorate the box.
输出装饰该盒子所需的不同方式的数量。
输入输出样例
输入#1
YYYYYY
输出#1
1
输入#2
BOOOOB
输出#2
2
输入#3
ROYGBV
输出#3
30
输入解题思路,AI测评打分。不知道怎么写?