UVA - 10733 The Colored Cubes (置换)

All 6 sides of a cube are to becoated with paint. Each side is is coated uniformly with one color. When a selectionof n different colors of paint is available, how many different cubes can youmake?

 

Note that any two cubes are onlyto be called "different" if it is not possible to rotate the one intosuch a position that it appears with the same coloring as the other.

 

Input

Each line of the input filecontains a single integer n(0<n<1000)denoting the number of different colors. Input is terminated by a line wherethe value of n=0. This line shouldnot be processed.

 

Output

For each line of input produce oneline of output. This line should contain the number of different cubes that canbe made by using the according number of colors.

 

SampleInput                           Outputfor Sample Input

1

2

0

1

10


Problem setter: EricSchmidt

Special Thanks: DerekKisman, EPS

题意:求用n中颜色涂立方体的不同种数,能旋转到的算一种

题意:和上一题UVA - 10601 Cubes (组合+置换) 的立方体旋转考虑的分类是一样的,不过这里我们考虑的是涂面的情况

1.不变置换(1)(2)(3)(4)(5)(6), 共1个;

2.沿对面中心轴旋转 90度, 270度 (1)(2345)(6), (1)(5432)(6) 同类共 6个;

3.沿对面中心轴旋转 180度 (1)(24)(35)(6), 同类共 3个;

4.沿对角线轴旋转 120度, 240度 (152)(346), (251)(643) 同类共 8个;

5.沿对边中点轴旋转 180度 (16)(25)(43) 同类共 6个;

#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
typedef long long ll;
using namespace std;

ll n;

ll still() {
	return n * n * n * n * n * n;
}

ll point() {
	return 4 * 2 * n * n;
}

ll edge() {
	return 6 * n * n * n;
}

ll plane() {
	return 3 * 2 * n * n * n + 3 * n * n * n * n;
}
	
ll polya() {
	ll ans = 0;
	ans += still();
	ans += point();
	ans += edge();
	ans += plane();
	return ans / 24;
}

int main() {
	while (scanf("%lld", &n) != EOF && n) {
		printf("%lld\n", polya());
	}
	return 0;
}


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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值