Zoj 2027 Travelling deformation, zoj2027
All 6 sides of a cube are to becoated with paint. Each side 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 before such a position that it appears with the same coloring as the other.
Input
Each line of the input filecontains a single integerN (0 <n <1000)Denoting the number of different colors. Input is terminated by a line wherethe valueN = 0. This line shouldnot be processed.
Output
For each line of input produce oneline of output. This line shoshould contain the number of different cubes that canbe made by using the according number of colors.
SampleInput Outputfor Sample Input
Problem setter: EricSchmidt
Special Thanks: DerekKisman, EPS
Calculate the number of different types of cubes that can be colored with n.
The classification is the same as that in the previous question about the rotation of a cube with a combination of 10601 Cubes (combination + replacement), but here we consider the situation of surface painting.
1. Constant replacement (1) (2) (3) (4) (5) (6), 1 in total;
2. Rotate 90 degrees along the opposite center axis, 270 degrees (1) (2345) (6), (1) (5432) (6) 6 similar;
3. Rotate 180 degrees (1) (24) (35) (6) along the center axis of the opposite side. There are 3 similar items;
4. Rotate 120 degrees along the diagonal axis, 240 degrees (152) (346), (251) (643) a total of 8 similar;
5. Rotate 180 degrees (16) (25) (43) of the same type along the midpoint axis of the edge;
[Cpp]View plaincopy
- # Include <iostream>
- # Include <cstdio>
- # Include <cstring>
- # Include <cmath>
- # Include <algorithm>
- Typedef long ll;
- Using namespace std;
- Ll n;
- Ll still (){
- Return n * n;
- }
- Ll point (){
- Return 4*2 * n;
- }
- Ll edge (){
- Return 6 * n;
- }
- Ll plane (){
- Return 3*2 * n + 3 * 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;
- }