URAL - 2068 The war for Westeros is still in process, manpower and supplies are coming to an end and the winter is as near as never before. The game of thrones is unpredictable so...
URAL - 2068 The war for Westeros is still in process, manpower and supplies are coming to an end and the winter is as near as never before. The game of thrones is unpredictable so...
这个题说的是给一个满二叉树,按照中序遍历的顺序给二叉树的节点从1开始编号从一个点到另一个点传送所花费的时间定义为这两个点之间路径的节点...-1或x+1x+1问需要多少时间才能从给出的起点传送到终点ural的题真长啊...
http://acm.timus.ru/problem.aspx?space=1&num=1627 生成树计数模板 #include<bits/stdc++.h> using namespace std; typedef long long ll; const int maxn = 105;......
题目描述 The “U.S. Robots” HQ has just received a rather alarming anonymous letter. It states that the agent from the competing «Robots Unlimited» has infiltrated into “U.S....
1009. K-based Numbers Time limit: 1.0 second Memory limit: 64 MB Let’s consider K-based numbers, containing exactly N digits. We define a number to be valid if its K-based notation ...
题目翻译一个充满好奇心的孩子有N(5≤N≤500)N(5\leq N\leq 500)个积木。这些积木可以构建不同的阶梯。阶梯由c(c≥2)c(c\geq 2)列组成,后一列的积木个数要比前一列积木个数要多(否则就不是阶梯了)。...
汉诺塔, 得到从初始状态到任意给出状态需要的次数的O(n)算法, 记结论吧☺☺ 比如要得到 BCCBABC 则对于原始的AAAAAAA 第一次令 res = ‘A', 然后对于给出的state从大的往小的开始扫, 当前是C所以第7个A变成C, ...
传送门:URAL 2070题目大意:有两个条件:1. 数为素数2. 数的因子个数为素数求区间 [ L , R ] 中同时满足或同时不满足以上两条的数的个数。思路:因为区间最大 1e12,无法求出素数的个数,所以考虑该问题的互斥事件...
1017. StaircasesTime limit: 1.0 secondMemory limit: 64 MBOne curious child has a set of N little bricks (5 ≤ N ≤ 500). From these bricks he builds different staircases. Staircase consists of ...
1495. One-two, One-two 2 Time limit: 2.0 second Memory limit: 64 MB A year ago the famous gangster Vito Maretti woke up in the morning and realized that he was bored of robbing banks of round sums....
题解: 容斥原理经典题目,mark一下~ #include<iostream> #include<cstdio> #include<cmath> #include<cstring> #include&...int p...
1012. K-based Numbers. Version 2 Time limit: 0.5 second Memory limit: 16 MB Let’s consider K-based numbers, containing exactly N digits. We define a number to be valid if its K-based notati
URAL - 2070点我点我:-) Interesting Numbers Time Limit: 2000MS Memory Limit: 65536KB 64bit IO Format: %I64d & %I64u Submit Status ...
传送门:URAL 2067题目大意:对于两个人 u、v,如果对于任意的人 w 他们满足 p( v, u) ≥ p( v, u, w) 则他们可以是最好的朋友。其中 p( v, u) = sqrt(( s v − s u) 2 + ( r ...
分类: ACM_Ural ACM_插头DP2013-08-03 20:45 333人阅读 评论(0) 收藏 举报 今天早上学了插头DP的思想和最基础的应用,中午就开始敲了,岐哥说第一次写不要看别人代码,利用自己的理解一点点得写出来,...
1、知识点:三角形外接圆 2、思路:外三层循环遍历组圆方式,内一层循环用于判断。重点在于计算外接圆中心坐标公式。先计算P1P2,P1P3的中垂线方程,然后联立求交点即可。/*用途:提交 **版本:2 ...
当K是L+1的倍数时,先手必败。 又因为L>=2,特殊考虑2*p的数据。 -------- #include #include using namespace std; int main() { int K,i,L; while (cin>>K){ for (i=3;i(int)sqrt(K);... if (K%i==0)
URAL - 2073 Nikolay has decided to become the best programmer in the world! Now he regularly takes part in various programming contests, attentively listens to problems ana
ural1519formula 1 给你一个n*m的矩阵,矩阵中有一些格子是坏的,现在要你在矩阵中画一个环,这个环要经过矩阵中所有好的格子一次,问你有多少种画法. 分析:典型的插头dp问题,详见cdq的论文>,这里我用的一般解法做的,...
标签: 后缀数组
WA在test16过不了,我并觉得我的程序没毛问题- - #include #include #include #include #define maxl 201000 using namespace std; ...int insn,n,ansind,ansl;...int c[maxl],rnk[maxl],sa[maxl],height[maxl],X[maxl],...
题意是给你n个数,让你在其中选择出few个数,few大于等于1小于等于n,让其和能整出n。一开始,考虑到给出的n的范围比较大,有10000,又有可能选择不连续的数字,可能有n的阶乘中可能性,后来在比赛结束之后,别人...
URAL 1635. Mnemonics and Palindromes(区间dp) 题目链接 题目大意:给定一个字符串,问分割成最少的子串,是每个子串均为回文串。 题目分析:可以用普通的区间dp做法,但是字符串的长度达到了4000,n^3会超时...
高大上的GAME啊。。
题目地址:http://acm.hust.edu.cn/vjudge/problem/viewProblem.action?id=11439 War Games 2 Time Limit:1000MS Memory Limit:65536KB 64bit IO Format:%I64d & %I64u ...
Ural 1557 题目大意为,两个黑客攻击一个相互连通的网络。网络中有n台计算机和m条链路。每一个人可以选择一条链路进行攻击并将其截断,问在这两个人攻击完成后,能够将这个网络分割成至少两个部分的方案由...
题目链接:...amp;num=20032003. Simple MagicTime limit: 1.0 secondMemory limit: 64 MBDo you think that magic is simple? That some hand-waving and muttering incomprehens...
标签: 枚举
题目链接 精度处理非常坑人 #include<cstdio> #include<iostream> #include<cmath> using namespace std; int main() ...
我不会啊 老老实实去学吧 求图的绝对中心 && 最小直径生成树 MDST 绝对重心呢 就是枚举每一条边 然后从这条边上某个坐标 到所有点的最小距离是一条折线 然后用这一组折线乱搞就好了怎么求MDST呢 从绝对重心跑...
题意:给出n条纵向的路,m条横向的路,走过路径的最小边权值为路径权值,求最大路径权值。 数据量很大,但是其实只有四种情况有可能走出最有解:第一条横向和最后一条纵向,第一条纵向和最后一条横向,最大横向和第...
传送门 题意:有两列摩托车,一列为从南向北行驶,一列从北向南行驶,且南北向路是双行线,而东西线路是单行线,要求的是两列摩托车经过十字路口的最短时间。 思路:小型模拟 using namespace std;... c...