上一页 1 ··· 8 9 10 11 12 13 14 15 下一页
摘要: 有N个派,F+1个人,每个人分到的体积要相等,而且每个人只能有一块派。 二分答案,对于一个mid,对每个派进行检测,尽量的多分,然后如果份数比F+1大,说明mid可以更大,就把mid给low。注意份数等于F+1时,也要向大的地方靠近。 二分答案的题都是这样的套路。 这种题精度是一个大坑。总是在wa和 阅读全文
posted @ 2016-01-31 19:00 Helica 阅读(367) 评论(0) 推荐(0) 编辑
摘要: 给出一个数字n,计算从1到n能组成几个不同的三角形。 n的范围是10^6,大概就是递推吧。从F[i-1]到F[i]可以线性求出。要注意结果超出int。 #include <cstdio> #include <cstring> #include <algorithm> using namespace 阅读全文
posted @ 2016-01-29 23:03 Helica 阅读(152) 评论(0) 推荐(0) 编辑
摘要: 计算一个大整数(10^100)中有没有一个小于L的素因子。这个大整数是两个素数的乘积。其实就是RSA加密。 做法是把大整数表示成千进位,用数组存储,然后一位一位地取模。 /*--------------------------------------------------------------- 阅读全文
posted @ 2016-01-29 22:59 Helica 阅读(384) 评论(0) 推荐(0) 编辑
摘要: 线性同余方程的模板题。和青蛙的约会一样。 #include <cstdio> #include <cstring> #define LL long long using namespace std; //A+n*C = B mod 2^k //n*C = B-A mod 2^k LL A,B,C,M 阅读全文
posted @ 2016-01-29 22:53 Helica 阅读(165) 评论(0) 推荐(0) 编辑
摘要: 从n+m步中挑选min(n,m)步向上走,剩下的就是向下走。 求解n+mCmin(n,m)时,要一边计算一边约分。 #include <cstdio> #include <algorithm> #include <iostream> using namespace std; unsigned int 阅读全文
posted @ 2016-01-29 12:56 Helica 阅读(124) 评论(0) 推荐(0) 编辑
摘要: 求出给定序列的序号。有一个定理需要知道 具体看这篇博客吧http://blog.csdn.net/lyy289065406/article/details/6648492 #include <cstdio> #include <cstring> #include <algorithm> using 阅读全文
posted @ 2016-01-29 11:17 Helica 阅读(299) 评论(0) 推荐(0) 编辑
摘要: 1 12 123 1234 把数按照这样的形式拍成一排,给一个序号求出那个序号对应的数。 当出现两位数。三位数时,要麻烦的处理一下。 #include <cstdio> #include <algorithm> #include <cmath> using namespace std; int T, 阅读全文
posted @ 2016-01-29 11:11 Helica 阅读(173) 评论(0) 推荐(0) 编辑
摘要: 614A-Link/Cut Tree 比较水,注意64位int仍然可能溢出。 #include <cstdio> #include <algorithm> #include <cstring> using namespace std; typedef unsigned long long int L 阅读全文
posted @ 2016-01-29 02:05 Helica 阅读(207) 评论(0) 推荐(0) 编辑
摘要: 当一个数的二进制表示中,0的个数大于或等于1的个数时,叫做RoundNumber。求从S到F两个数(包含)之间的RoundNumber个数。 这类题一般都是先求出0到N的个数,然后两个相减。 由于题目是考虑二进制中01的个数,当位数固定时,很方便计算。于是从位数方面解决问题。 设N表示成二进制的位数 阅读全文
posted @ 2016-01-29 02:01 Helica 阅读(218) 评论(0) 推荐(0) 编辑
摘要: http://poj.org/problem?id=3254从这里学的 http://blog.csdn.net/accry/article/details/6607703状压dp的入门题。一片N×M的田地,有的地方可以种玉米,有的地方不可以。种玉米的区块不能相邻。种玉米的求总方案数,不种玉米也是一... 阅读全文
posted @ 2015-12-11 01:38 Helica 阅读(1501) 评论(0) 推荐(0) 编辑
上一页 1 ··· 8 9 10 11 12 13 14 15 下一页