UvaOJ 10167】的更多相关文章

暴力搜索 #include<cstdio> struct node { int x; int y; }s[]; int main() { //freopen("input.txt","r",stdin); int a,b,n,num; int i; bool flag; while(scanf("%d",&n) && n) { ; i < * n; i++) scanf("%d%d",…
http://www.cnblogs.com/sxiszero/p/3618737.html 下面给出的题目共计560道,去掉重复的也有近500题,作为ACMer Training Step1,用1年到1年半年时间完成.打牢基础,厚积薄发. 一.UVaOJ http://uva.onlinejudge.org 西班牙Valladolid大学的程序在线评测系统,是历史最悠久.最著名的OJ. 二.<算法竞赛入门经典> 刘汝佳  (UVaOJ  351道题) 以下部分内容摘自:http://sdkd…
uvaoj 10397 - Connect the Campus Many new buildings are under construction on the campus of the University of Waterloo. The university has hired bricklayers, electricians, plumbers, and a computer programmer. A computer programmer? Yes, you have been…
首先是原题,转自UVAOJ  The ? 1 ? 2 ? ... ? n = k problem  The problem Given the following formula, one can set operators '+' or '-' instead of each '?', in order to obtain a given k? 1 ? 2 ? ... ? n = k For example: to obtain k = 12 , the expression to be us…
/* 题意:矩阵相乘的最少的步数 dp[i][j]=min(dp[i][j], dp[i][k]+dp[k+1][j]+num[i-1]*num[k]*num[j]); 表示的是第i个矩阵到第j个矩阵相乘的最少步数 sign[i][j]表示的是第i个矩阵到第j个矩阵相乘的最少步数是由第i个矩阵到第sign[i][j]个矩阵相乘最少步数 和第sign[i][j]+1个矩阵到第j个矩阵相乘最少步数的得到的最小值! */ #include<iostream> #include<cstring&…
1 /* 题目大意: 从一个点到达另一个点有多条路径,求这多条路经中最大噪音值的最小值! . 思路:最多有100个点,然后又是多次查询,想都不用想,Floyd算法走起! */ #include<iostream> #include<cstring> #include<cstdio> #define INF 0x3f3f3f3f using namespace std; ][]; int main(){ int n, m, q; int u, v, d; ; scanf(…
/************************************************************************* > File Name: test.cpp > Author: HJZ > Mail: 2570230521@qq.com > Created Time: 2014年08月03日 星期日 07时26分58秒 ****************************************************************…
题意:给定一个有向图,寻找一个点数最大集合,使得这个集合中的任意两个点 u,v, 都有u->v 或者 v->u 或者u<==>v 思路:首先将强连通分量通过tarjan算法求出来,然后进行缩点,也就是每一个缩点 所组成的图就是一个DAG图!令每一个点的权值就是这个缩点所包含节点(也就是对应的 强连通分量的节点数目),因为强连通分量的任意的两个节点都是相互可达的,那么这个 缩点要么选要么不选,问题就转换成了DAG图上的最长路径! #include<iostream> #i…
题意:1到n节点(节点之间有一定的容量),需要流过C的流量,问是否可以?如果可以输出possible, 否则如果可以扩大任意一条边的容量 可以达到目的,那么输出possible option:接着输出每一条可以达到目的的边(按升序),再否则输出not possible 思路:先求一次最大流,如果流量至少为C,则直接输出possible,否则需要修改的弧一定在最小割里! 接着吧这些弧(最小割里的)的容量设为无穷大,然后在求最大流,看最大流的流量能否满足是C即可,如果满足了,那就把这一条边记录下来…
 Problem G. Birthday Cake  Problem's Link:http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&category=13&problem=1108&mosmsg=Submission+received+with+ID+14413715 Mean: http://luckycat.kshs.kh.edu.tw/…