2531
来源:互联网 发布:约瑟夫环算法 数组 编辑:程序博客网 时间:2024/04/30 15:33
#include<iostream>using namespace std;const int SIZE = 21;int QA[SIZE] = {0};int QB[SIZE] = {0};int map[SIZE][SIZE] = {0};int N = 0;int tem = 0;int sum = 0;void dfs(int a, int b, int step);int main(){freopen("input.txt", "r", stdin);setbuf(stdout, NULL);cin >> N;for(int i = 1; i <= N; i++){for(int j = 1; j <= N; j++){cin >> map[i][j];}}QA[0] = 1;dfs(1, 0, 1);cout << sum << endl;return 0;}void dfs(int a, int b, int step){if(step == N){tem = 0;for(int i = 0; i < a; i++){for(int j = 0; j < b; j++){tem += map[QA[i]][QB[j]];}}if(tem > sum){sum = tem;}return;}step++;QA[a] = step;dfs(a+1, b, step);QB[b] = step;dfs(a, b+1, step);}
0 0
- 2531
- 2531
- 2531
- poj 2531
- POJ 2531
- POJ 2531
- poj 2531
- POJ 2531
- POJ 2531
- poj-2531
- poj 2531
- poj 2531
- poj - 2531
- HDU 2531
- poj 2531
- POJ-2531
- POJ 2531(随机化思想)
- poj 2531 Network Saboteur
- js中几种实用的跨域方法原理详解
- 打游戏的教育意义
- C++知识点随笔(四):耦合问题、new和malloc、虚析构、多继承
- MySQL创建数据库并授权的SQL
- Jdeveloper 12c 实体主键自动生成 使用 oracle.jbo.server.SequenceImpl 报错
- 2531
- [Java]编译学习之一
- ppt转换成pdf转换器应用介绍
- plist文件中的Boolean类型
- 治愈系--致郁系
- 使用STM32F4XX自带数学库"arm_math.h"
- 第一个自己完成的leetcode( JAVA) Implement Queue using Stacks
- [LeetCode]Longest Palindromic Substring
- c#猜猜看