ACM: 深搜 poj 2531 (一开始,居然…
来源:互联网 发布:淘宝网店加盟哪家好 编辑:程序博客网 时间:2024/06/05 18:54
Description
A university network is composed of N computers. Systemadministrators gathered information on the traffic between nodes,and carefully divided the network into two subnetworks in order tominimize traffic between parts.
A disgruntled computer science student Vasya, after being expelledfrom the university, decided to have his revenge. He hacked intothe university network and decided to reassign computers tomaximize the traffic between two subnetworks.
Unfortunately, he found that calculating such worst subdivision isone of those problems he, being a student, failed to solve. So heasks you, a more successful CS student, to help him.
The traffic data are given in the form of matrix C, where Cij isthe amount of data sent between ith and jth nodes (Cij = Cji, Cii =0). The goal is to divide the network nodes into the two disjointedsubsets A and B so as to maximize the sum ∑Cij (i∈A,j∈B).
Input
The first line of input contains a number of nodes N (2<= N <= 20). The following N lines,containing N space-separated integers each, represent the trafficmatrix C (0 <= Cij <= 10000).
Output file must contain a single integer -- the maximum trafficbetween the subnetworks.
Output
Output must contain a single integer -- the maximum trafficbetween the subnetworks.
Sample Input
3
0 50 30
50 0 40
30 40 0
Sample Output
90
题意: 坏学生要破坏学校网络. 要找出两个A~B两个子网络的最大距离.
解题思路:
代码:
#include <cstdio>
#include <iostream>
#include <cstring>
using namespace std;
#define MAX 21
int grid[MAX][MAX];
int result;
int div[MAX];
int n;
void dfs(int node,int data)
{
}
int main()
{
}
- ACM: 深搜 poj 2531 (一开始,居然…
- ACM: 深搜 poj 2676
- POj 2379 ACM Rank Table
- ACM: 图论题 poj 2240 (floyd + ST…
- ACM: polay定理 数论题 poj 1286 …
- ACM: 回文串 dp题 poj 1159 (滚动…
- ACM: 最小堆 poj 2227 最小堆 fro…
- ACM: 最小堆 poj 2274 思路清晰, …
- ACM: 深搜题 poj 3411
- ACM: poj 1664
- ACM: poj 1050
- ACM: poj 1964
- ACM: poj 3141
- ACM: poj 1903
- hdoj acm 1008
- ACM PKU 2729 -- Robocode (…
- ACM: dp题 poj 1276 go on 动态规…
- ACM: 深搜+剪枝 poj 1416
- 2016"百度之星" - 资格赛(Astar Round1)(hdu5685(线段树、乘法逆元),hdu5686(大数),hdu5687(字典树),hdu5688)
- ACM: 一题DFS(深搜,剪枝) poj 1011
- ACM: 一题STL map题 poj 1002 (bt…
- ACM: 简单数学推导+挑战平台的精度…
- ACM: 初中数学 poj 1328
- ACM: 深搜 poj 2531 (一开始,居然…
- ACM: 高速打素数表 TOJ 3749 (疯狂…
- ACM: 数论 台州OJ 3151 (久违的数…
- ACM: poj 1664
- linux入门
- ACM: 广搜+素数 poj 3126 (素数表…
- ACM: 模拟队列判定 poj 1426
- JavaScript跨域(1):什么是跨域,如何跨域
- ACM: 三维迷宫广搜最短路 poj 2251…