zoukankan      html  css  js  c++  java
  • [蓝桥杯2016决赛]七星填数

    题目链接:http://oj.ecustacm.cn/problem.php?id=1316

    以0开始,为空点编号,然后进行全排列

    #include <iostream>
    #include <cstring> 
    #include <vector>
    #include <queue>
    #include <algorithm>
    
    using namespace std;
    
    int main() {
        
    //    cout << "10 3 9 8" << endl;
        
        return 0;
        
        int arr[11] = {1,2,3,4,5,7,8,9,10,12,13};
        
        int cnt = 0;
        int flag = 0;
        int res[7];
        do {
            res[0] = arr[0] + arr[1] + arr[2] + arr[3];
            res[1] = arr[3] + arr[4] + arr[5] + arr[6];
            res[2] = arr[6] + arr[7] + arr[8] + arr[9];
            res[3] = arr[9] + arr[10] + arr[1] + 14;
            res[4] = 14 + arr[2] + arr[4] + 6;
            res[5] = 6 + arr[5] + arr[7] + 11;
            res[6] = 11 + arr[8] + arr[10] + arr[0];
            int m = 0;
            for (int i = 0; i < 6; i++) {
                if (res[i] != res[i+1]) m = 1;
            }
            
            if (!m) flag = 1;
            
    //        
            cnt++;
        }while(next_permutation(arr, arr+11) && flag==0);
        cout << cnt << endl;
        for (int i = 0; i < 11; i++)
            printf("%d ", arr[i]);
        printf("
    ");
        return 0;
    }
    View Code

    。。。。

  • 相关阅读:
    CodeForces
    HDU
    HDU
    POJ
    URAL
    POJ
    UVa
    UVa
    UVa
    UVa
  • 原文地址:https://www.cnblogs.com/hello-dummy/p/12785288.html
Copyright © 2011-2022 走看看