poj 2531

暴力搜索 因为数据太弱 并不想去加什么剪枝


#include 
#include 
#include 
#include 
using namespace std;

#define met(a, b) memset(a, b, sizeof(a))

const int N = 25;

int g[N][N], vis[N], n, ans;

void dfs (int k, int sum);

int main ()
{
    while (cin >> n)
    {
        for (int i=0; i> g[i][j];

        ans = 0;
        met (vis, 0);
        vis[0] = 1;
        dfs (0, 0);
        cout << ans << endl;
    }
    return 0;
}

void dfs (int k, int sum)
{
    int x = sum;
    for (int i=0; i ans) ans = x;

    for (int i=k+1; i


你可能感兴趣的:(poj 2531)