Cubes UVA10601 POLYA 定理

Topic Link

 

Solution

 

Tuple $ (i, j) $ represents the number of cycles section, the number of cycles. (A combination of mathematics called equivalence classes K and fixed displacement class?)
Constant replacement: $ 1 * (1,12) $
Centroid + $ 90: 3 * (4,3) $
Face-centered $ -90: 3 * (4,3) $
$ Centroid 180: 3 * (2,6) $
对棱 $ 180: 6 * [(2,5) + (1,2)] $
Body-centered $ 120: 4 * (3, 4) $
Body-centered $ 240: 4 * (3, 4) $
 
Then the remaining question is how to fill in the color of the inside of these equivalence classes
Considered differentiated color balls, no difference in the equivalence classes considered box, a combinatorial problem
 
/ * 
    Tuple (i, j) represents the number of cycles of the section, the number of cycles, a combination of mathematics called fixed displacement type K equivalence classes and 
    constant displacement: 1 * (1, 12) 
    face-centered + 90: 3 * (4,3) 
    face-centered -90: 3 * (4,3) 
    face centered 180: 3 * (2,6) 
    of the ribs 180: 6 * [(2,5) + (1,2)] 
    body centered 120: 4 * (3,4) 
    body-centered 240: 4 * (3,4) 
* / 
#include <algorithm> 
#include <the cctype> 
#include <the cmath> 
#include <cstdio> 
#include <the cstdlib> 
#include < CString> 
#include <the iostream> 
#include <Map> 
#include <Queue> 
#include < SET > 
#include <Stack>
 #if __cplusplus >= 201103L
#include <unordered_map>
#include <unordered_set>
#endif
#include <vector>
#define lson rt << 1, l, mid
#define rson rt << 1 | 1, mid + 1, r
#define LONG_LONG_MAX 9223372036854775807LL
#define ll LL
using namespace std;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef pair<int, int> P;
int n, m, k;
const int maxn = 1e5 + 10;
int a[7], b[7];
inline ll fac(ll n)
{
    ll res = 1;
    for (int i = 2; i <= n; i++)
        res *= i;
    return res;
}
inline ll C(ll n, ll m)
{
    if (n < m)
        return 0;
    return fac(n) / (fac(m) * fac(n - m));
}
inline ll doit(int k)
{
    memcpy(b, a, sizeof a);
    int group = 0;
    for (int i = 1; i <= 6; i++)
    {
        if (b[i] % k)
            return 0; //不能完全以k划分
        b[i] /= k;
        group += b[i];
    }
    ll res = 1;
    for (int i = 1; i <= 6; i++)
    {
        RES * = C (Group, B [I]); 
        Group - = B [I]; 
    } 
    return RES; 
} 
inline LL Solve () 
{ 
    LL RES = 0 ; 
    RES + doIt = ( . 1 );          // Fixed displacement 
    + = RES 2 * . 3 * doIt ( . 4 ); // centroid 90 +, -90 
    RES + = . 3 * doIt ( 2 );      // centroid 180 [ 
    for ( int I = . 1 ; I <= . 6 ; I ++)
        for (int j = 1; j <= 6; j++)
        {
            if ((i == j && a[i] < 2) || (i != j && (!a[i] || !a[j])))
                continue;
            a[i]--, a[j]--;
            res += 6 * doit(2); //对棱180
            a[i]++, a[j]++;
        }
    res += 2 * 4 * doit(3); //体心+120,-120
    return res / 24;
}
int main(int argc, char const *argv[])
{
#ifndef ONLINE_JUDGE
    freopen("in.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
#endif
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int t;
    cin >> t;
    while (t--)
    {
        memset(a, 0, sizeof a);
        for (int i = 0; i < 12; i++)
        {
            int x;
            cin >> x;
            a[x]++;
        }
        cout << solve() << "\n";
    }
    return 0;
}
View Code

 

Guess you like

Origin www.cnblogs.com/mooleetzi/p/11431006.html