- 博客(234)
- 资源 (2)
- 收藏
- 关注
原创 uva 1637 - Double Patience
uva 1637 Double Patience (全概率)根据全概率公式: 每次取得的概率是一样的,所以进行操作的时候,可以将所有的概率加起来,然后除以他们发生的种类数,递归中所有的情况都是全概率的情况,所以每个概率都需要计算出来,然后慢慢往上推出来,最后获取一开始的情况,乘以条件发生的概率1/k,k为一开始可以取得方法数。WRONG ANSWER:#include#include
2015-09-24 15:31:59
515
原创 hdu5464(Clarke and problem)
Clarke and problemTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 532 Accepted Submission(s): 232Problem DescriptionClarke is
2015-09-22 14:40:07
487
原创 唯一分解
#include#include#include#includeusing namespace std; #define M 2000000000#define INF 2000000000int ons = 0,ans = 0;int prime[100000];int v[4000];void init(){ for(int i = 2;i<=(int)sqrt(1.0
2015-09-06 11:11:47
673
原创 (uva11671)差分约束问题总结
11671 - Sign of MatrixTime limit: 1.000 seconds这个问题是个差分约束的问题,但是一开始看这个问题的时候没有发现是个差分约束的题,而且这个题我想了很长时间,在网上看的题解也没有看懂,甚是麻烦。然后经过仔细思考才发现这个题是差分约束的苗头,根据这个题目的目的,是对行和列进行操作,每次对行或列进行加或减操作,题目的目的是使
2015-09-03 16:20:07
1345
原创 (poj3159)dijkstra优先队列实现
poj3159#include#include#include#includeusing namespace std; int n,m,head[30010];int c;struct is{ int index,cost; friend bool operator <(is a,is b){ if(a.cost== b.cost)return a.inde
2015-09-02 19:37:53
916
3
原创 sap算法速推,dinic算法速推
sap算法,用求解k短路的思想,从后面进行bfs,(从前面也行,k短路不行),目的是获取距离标号,进行增广时减少不必要的路径,直接获取最短的路径, ek算法bfs的目的是找到增光路,sap算法使用距离标号数组目的是使增广路最短,仅此而已。
2015-08-26 16:22:53
542
原创 --uva247(calling circles)强联通与floyd-warshell
图论题:一开始我是用tarjan算法做的,wrong answer 了很多次,然后又用了floyd-warshell算法,也wa了最后找了题解,原来最后的dataset后面不是组数,是样例的编号,题根本就没说,让人怎么理解。。。tarjan#include<stdio.h>#include<iostream>#include<st...
2015-08-17 21:06:00
269
1
原创 --Untltled(hdu5339) (集合子集的枚举,二进制枚举)
二进制枚举即可:#include<stdio.h>#include<string.h>#include<algorithm>using namespace std;int cmp(int a,int b){ return a > b;} int main(){ int t; scanf...
2015-08-17 20:00:00
257
原创 --acm的思考
现在从网上找的标程,基本上是一个思路,分明是根据别人的思路照搬下来的,这到底有什么用,acm的魅力不就是思考和解决问题吗,你把思考和解决问题的逻辑这步去掉,单纯的码代码,到底是图什么? 现在学习东西也是这样,一个按部就班的框架,完全失去了学习新东西的刺激和挑战。 摸索这个词应该很多人都不用了吧,很多人也都很陌生了吧,急功近利从来都不是人类进化的动力,人...
2015-08-14 20:33:00
120
原创 --最小生成树的处理(始终抓取最小边的克鲁斯卡尔算法)
Consider yourself lucky! Consider yourself lucky to be still breathing and having fun participating inthis contest. But we apprehend that many of your descendants may not have this luxury. For, a...
2015-08-14 11:02:00
136
原创 --wrong answer
//http://acm.hust.edu.cn/vjudge/contest/view.action?cid=87121#problem/C#include<stdio.h>#include<string.h>#include<algorithm>using namespace std;const int M = 1000 *...
2015-08-13 16:50:00
120
原创 --最小生成树
B -Slim SpanTime Limit:3000MSMemory Limit:0KB64bit IO Format:%lld & %lluSubmitStatusDescriptionGiven an undirected weighted graphG<tex2html_verbatim_m...
2015-08-11 10:56:00
99
原创 --数论->被想复杂的一道题
计算 n/1 + n/2 + n/3 +n/4 + ... + n/n =?一开始的思路是将n提取出来 :原式 = n* (1+ 1/2 + 1/3 + 1/4 + ... 1/n) = n * (ln(n) + c) c是欧拉常数 ,约为0.5772,样例挂然后发现这样会多加上那些没被整除的被省略的分数,比如 2/3 = 0,但是在上面的式子里分数也是算上的,...
2015-08-10 21:05:00
171
原创 --hdu2717->搜索的范围控制
C -开Time Limit:2000MSMemory Limit:32768KB64bit IO Format:%I64d & %I64uSubmitStatusPracticeHDU 2717DescriptionFarmer John has been informed of the location of a...
2015-08-08 15:30:00
107
原创 --暴力注意事项
http://acm.hust.edu.cn/vjudge/contest/view.action?cid=85911#problem/C暴力的时候,注意化解出来的公式,要用最简单的循环进行处理,并且明确在处理的过程中是否会超时和 爆int#include<stdio.h>#include<string.h>#include<...
2015-08-06 11:04:00
104
原创 --hdu1498->二分图应用,行列不重复运算
E -50 years, 50 colorsTime Limit:1000MSMemory Limit:32768KB64bit IO Format:%I64d & %I64uSubmitStatusPracticeHDU 1498Appoint description:System Crawler (2015-07-3...
2015-08-04 15:13:00
129
原创 --hdu1281->二分图最大匹配(唯一匹配判断)
D -棋盘游戏Time Limit:1000MSMemory Limit:32768KB64bit IO Format:%I64d & %I64uSubmitStatusPracticeHDU 1281Appoint description:System Crawler (2015-08-02)Descrip...
2015-08-04 10:23:00
373
原创 --bestcoder
UntitledTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 774Accepted Submission(s): 423Problem DescriptionThere is an integeraan...
2015-08-03 10:37:00
103
原创 --hdu 1151 - > 双向路径搜索解决覆盖问题
http://acm.hdu.edu.cn/showproblem.php?pid=1151伞兵可以降落到图上的任意一个点,用最少的伞兵在单向道路上走完所有的点解决:对一个点双向dfs,目的在于找到任意一个其他伞兵未访问的非起点,只要找到这个点,则可以保证这条路径是最佳的;因为路是单向的,所以从这个点出发后,就不会再次回到这个点(题...
2015-08-01 10:44:00
93
原创 __BFS(POJ3126)
简单bfs,处理的时候,用的Map没过,看来这个题得好好考虑考虑时间复杂度了#include<stdio.h>#include<string.h>#include<queue> #include<algorithm>using namespace std;int visit[10010];int visi...
2015-05-22 12:05:00
136
原创 __周赛(最小生成树(Prime))
将已经链接的边的权值设为0即可。但是可能会超时,提交的时候,有一次显示超时,所以这个解法是有问题的,看到有171ms的,实力差的太大了,还是得使劲刷题。/*2015-5-18 951ms*/#include<stdio.h>#include<string.h>#include<algorithm>using namespac...
2015-05-18 20:11:00
103
原创 --BestCoder (#41-B)
ZCC loves stringsTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 262144/131072 K (Java/Others)Total Submission(s): 264Accepted Submission(s): 100Problem DescriptionZCC has got N...
2015-05-17 12:32:00
97
原创 --字符串读入
E -Hardwood SpeciesTime Limit:10000MSMemory Limit:65536KB64bit IO Format:%I64d & %I64uSubmitStatusPracticePOJ 2418DescriptionHardwoods are the botanical group ...
2015-05-16 16:58:00
83
原创 --g++||c++
A -An easy problemTime Limit:1000MSMemory Limit:32768KB64bit IO Format:%I64d & %I64uSubmitStatusPracticeHDU 2055Descriptionwe define f(A) = 1, f(a) = -1, f(B) ...
2015-05-16 16:56:00
125
原创 --组合数学(POJ3286)
http://acm.hust.edu.cn/vjudge/contest/view.action?cid=78044#problem/B给定两个数 m,n ,让你求在【m,n】范围里,所有数的0的个数。思路: 从个位开始列举,1233,个位是零的情况有124种,这里我们将0算在情况里; 十位是0的时候,需要考虑,当前导为0 的时候,会导致错误,比如01,0...
2015-05-16 16:04:00
105
原创 --山东省第六届省赛--B
Map的使用,掌握基础STL的使用。#include<stdio.h>#include<string.h>#include<map>#include<algorithm>using namespace std;int main(){ int t; scanf("%d",&...
2015-05-15 20:44:00
124
原创 --二分--利用结果范围进行查找
给定起点和终点之间的距离 L ,在起点和终点之间存在 n 个点,给出这 n 个点距离起点的距离,求把这n个点中去掉m个点后剩余点之间可能的最小值的最大值(即求 n-m 个点之间距离最小值的最大值) 。首先知道结果必然存在于在不操作的最小值和L之间,答案范围确定。然后就是给定middle含义: 比最小值略小的一个值。用一个for循环进行处理,最后得到的值blocks满...
2015-05-15 10:01:00
93
原创 ~超时--拓扑排序
D - Reward Time Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64u SubmitStatusDescriptionDandelion’s uncle is a boss of a factory. As the spring festival is coming , he wants
2015-03-03 15:00:35
628
原创 bfs--Codeforces,520B.
http://codeforces.com/problemset/problem/520/B题目给定两个数n,m,让你将n通过-1 或者 *2 操作获取m,1<=n<=m<=10000,且过程中不产生负数。思路:建立二叉树,然后bfs,水题。#include<stdio.h>#include<string.h>#include<queue>#include<algorithm>using n
2015-03-03 08:17:57
939
原创 map--codeforces,519D.
http://codeforces.com/problemset/problem/519/D 题意:给定26个字母的值,给定一个字符串,查找字符串中的子串,要求子串满足:串首和串尾字母是一样的,除了串首和串尾,该子串的所有字母的值加和为0;题解: 这道题我是根据别人的思路整理的。 思路:前缀和。 对于字符串的每个字母进行前缀和的更新,当检测到相同的字母时,判断该
2015-03-01 19:05:36
617
原创 关于(a+b)/3的证明--codeforces,519c.
http://codeforces.com/problemset/problem/519/C 题目要求:给定两个数,分别将这两个数进行任意拆分,拆分成1和2,然后再将拆分好的数进行相加,相加的两个数和必须是3,且1和2分别来自不同的被拆分数,要求可以相加的最大数量。性质: 假定a是较小的数,b是较大的数。 1 数量必定少于a和b; 2 当b>2a时,数量是a;
2015-03-01 15:39:33
730
原创 算法设计技巧--离散暴力将时间将为O(1)
http://acm.hdu.edu.cn/showproblem.php?pid=5179/*摘要:Let A=∑ni=1ai∗10n−i(1≤ai≤9)(n is the number of A's digits). We call A as “beautiful number” if and only if a[i]≥a[i+1] when 1≤i<n and a[i] mod a[j]=0
2015-03-01 10:30:02
3062
原创 计算时间复杂度 -- 写程序需瞻前顾后
John has n points on the X axis, and their coordinates are (x[i],0),(i=0,1,2,…,n−1). He wants to know how many pairs<a,b> that |x[b]−x[a]|≤k.(a<b)。
2015-03-01 09:39:54
585
原创 CF C.Guess Your Way Out!
C. Guess Your Way Out!time limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputAmr bought a new video game "Guess Your Way Out
2015-02-07 12:44:28
943
原创 498ACRAZYTOWN
A. Crazy Towntime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputCrazy Town is a plane on which there are n infinite line
2015-02-06 11:34:51
542
原创 505B. Mr. Kitayuta's Colorful Graph(拆分图+并查集)
B. Mr. Kitayuta's Colorful Graphtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputMr. Kitayuta has just bought an undir
2015-02-04 10:34:59
868
原创 随便写写
1 临接矩阵 略2 临接链表 这个方法木指针struct edge{ int to,w,next;}e[10010];//to 是这条边指向的顶点,w是边的权值,next是与该点邻接的下一条边的数组下标 int head[10010]for(i = 0;iscanf("%d%d%d",&start,&end,&values);e[i].to = end
2015-02-03 15:22:23
350
原创 字符串
A BCDEFGHD - Mr. Kitayuta's GiftCrawling in process...Crawling failedTime Limit:1000MS Memory Limit:262144KB 64bit IO Format:%I64d & %I64u SubmitStatus D
2015-01-26 17:30:57
522
原创 栈的应用 - 简单计算器
A BCDEFGHE - 简单计算器Crawling in process...Crawling failedTime Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64uSubmitStatus Practice HDU 1237
2015-01-25 23:26:15
865
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人
RSS订阅