uva 10733 - The Colored Cubes(置换)

题目链接:uva 10733 - The Colored Cubes

题目大意:给定n,表示有n种颜色,为立方体上色,相同旋转视为一种。

解题思路:参考uva 10601 - Cubes,正方体的旋转都是一样的,只要由考虑边的颜色变成考虑面的颜色。

#include <cstdio>
#include <cstring>
#include <algorithm>

using namespace std;
typedef long long ll;
ll n;

ll solve (int k) {
    ll ret = 1;
    for (int i  = 0; i < k; i++)
        ret *= n;
    return ret;
}

ll still () {
    return solve(6);
}

ll rot_point () {
    return 2 * 4 * solve(2);
}

ll rot_edge () {
    return 6 * solve(3);
}

ll rot_plane () {
    return 3 * 2 * solve(3) + 3 * solve(4);
}

ll polya () {
    return still() + rot_point() + rot_edge() + rot_plane();;
}

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

你可能感兴趣的:(uva 10733 - The Colored Cubes(置换))