上一页 1 ··· 51 52 53 54 55 56 57 58 59 ··· 71 下一页
摘要: http://acm.sdut.edu.cn/sdutoj/problem.php?action=showproblem&problemid=2426这题本来是按高度从大到小找的 要向上向下都得更新啊 结果TLE了 然后又从小到大排序线段树+离散化 把对应的值开个数组存起来 最后算面积的时候 用离散前的值算 高度从小到大排好序更新 这样比较简单View Code 1 #include<stdio.h> 2 #include<iostream> 3 #include<string.h> 4 #include<algorithm> 5 usi 阅读全文
posted @ 2012-08-28 11:36 _雨 阅读(165) 评论(0) 推荐(0) 编辑
摘要: http://acm.sdut.edu.cn/sdutoj/problem.php?action=showproblem&problemid=2427线段树+离散化 不离散化不知道会不会超时 一直RE 可能N值没有说的那么小吧 题意有问题 按1W开数组就RE 按10W开就A了View Code 1 #include<stdio.h> 2 #include<string.h> 3 #include<algorithm> 4 #include<iostream> 5 using namespace std; 6 #define N 10000 阅读全文
posted @ 2012-08-27 21:37 _雨 阅读(153) 评论(0) 推荐(0) 编辑
摘要: 欧拉回路:图G,若存在一条路,经过G中每条边有且仅有一次,称这条路为欧拉路,如果存在一条回路经过G每条边有且仅有一次,称这条回路为欧拉回路。具有欧拉回路的图成为欧拉图。判断欧拉路是否存在的方法有向图:图连通,有一个顶点出度大入度1,有一个顶点入度大出度1,其余都是出度=入度。 无向图:图连通,只有两个顶点是奇数度,其余都是偶数度的。 判断欧拉回路是否存在的方法有向图:图连通,所有的顶点出度=入度。 无向图:图连通,所有顶点都是偶数度。 程序实现一般是如下过程: 1.利用并查集判断图是否连通,即判断p[i] < 0的个数,如果大于1,说明不连通。 2.根据出度入度个数,判断是否满足要求。 阅读全文
posted @ 2012-08-27 17:38 _雨 阅读(251) 评论(0) 推荐(0) 编辑
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=4396二维最短路 以这个点和到这个点的路径数作为一个点来标记View Code 1 #include <iostream> 2 #include<cstdio> 3 #include<string.h> 4 #include<queue> 5 #define INF 0xfffffff 6 using namespace std; 7 struct node 8 { 9 int v,w,next;10 }men[200011];11 struct mode12 阅读全文
posted @ 2012-08-25 20:08 _雨 阅读(217) 评论(0) 推荐(0) 编辑
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=4380交对的时候 有种被坑的感觉 拓扑就水过去了 实在没想到View Code 1 #include <iostream> 2 #include<cstdio> 3 #include<string.h> 4 using namespace std; 5 int de[2001]; 6 char c[2001][2001]; 7 int main() 8 { 9 int i,j,t,n,m,f,k,kk =0;10 scanf("%d",&t);1 阅读全文
posted @ 2012-08-24 10:02 _雨 阅读(162) 评论(0) 推荐(0) 编辑
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=4380求三角形内的点的个数为奇数的三角形数 官方解题报告提供的是O(n2+m)的算法 先算两点与原地围成的三角形 最后总的有向三角形面积等于三者之和实在不知道有向面积怎么转换成无向的 交了十几次依旧WA 在网上看到另一种做法 感觉很好利用叉乘算出每个线段下面的点 三角形是由三条线段所围成 所以用一条减去两条(钝角)或者两条减一条(锐角)就能得到三角形区域 所以它包围的点数也就出来 了View Code 1 #include <iostream> 2 #include<cstdio> 3 阅读全文
posted @ 2012-08-24 08:53 _雨 阅读(191) 评论(0) 推荐(0) 编辑
摘要: Dual Palindromes Mario Cruz (Colombia) & Hugo Rickeboer (Argentina)A number that reads the same from right to left as when read from left to right is called a palindrome. The number 12321 is a palindrome; the number 77778 is not. Of course, palindromes have neither leading nor trailing zeroes, s 阅读全文
posted @ 2012-08-22 20:45 _雨 阅读(245) 评论(0) 推荐(0) 编辑
摘要: Palindromic Squares Rob KolstadPalindromes are numbers that read the same forwards as backwards. The number 12321 is a typical palindrome.Given a number base B (2 <= B <= 20 base 10), print all the integers N (1 <= N <= 300 base 10) such that the square of N is palindromic when expressed 阅读全文
posted @ 2012-08-22 20:23 _雨 阅读(151) 评论(0) 推荐(0) 编辑
摘要: http://acm.sdut.edu.cn/sdutoj/problem.php?action=showproblem&problemid=2417找峰值点 从小到大输出View Code 1 #include<stdio.h> 2 #include<string.h> 3 int a[50001],b[50001]; 4 int main() 5 { 6 int i,j,k,n,m; 7 while(scanf("%d", &n)!=EOF) 8 { 9 int g = 0;10 for(i = 1; i <= n ; i+ 阅读全文
posted @ 2012-08-22 19:37 _雨 阅读(185) 评论(0) 推荐(0) 编辑
摘要: TransformationsA square pattern of size N x N (1 <= N <= 10) black and white square tiles is transformed into another square pattern. Write a program that will recognize the minimum transformation that has been applied to the original pattern given the following list of possible transformation 阅读全文
posted @ 2012-08-21 21:16 _雨 阅读(168) 评论(0) 推荐(0) 编辑
上一页 1 ··· 51 52 53 54 55 56 57 58 59 ··· 71 下一页