点击打开链接
Romantic Value
Time Limit: 2 Seconds Memory Limit: 65536 KB
Farmer John is a diligent man. He spent a lot of time building roads between his farms. From his point of view, eve...
分类:
其他好文 时间:
2015-03-21 14:04:52
阅读次数:
140
这个判断方法真的没想到。。。
对于在S中匹配M,如果M上一次的匹配位置pre与这一次的匹配位置now满足now-pre >= M.length,则加1。
这个判断太跳了233
。
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#...
分类:
其他好文 时间:
2015-03-20 10:53:51
阅读次数:
146
首先这个圆边上必有至少两点,打乱数组,然后利用枚举,不断重新定义圆,找出最小的圆
代码:
#include
#include
#include
#include
using namespace std;
const int N = 100005;
const double eps = 1e-8;
int n;
struct Point {
double x, y;...
分类:
其他好文 时间:
2015-03-19 10:19:06
阅读次数:
129
There is a very simple and interesting one-person game. You have 3 dice, namely
Die1, Die2 and Die3. Die1 has
K1 faces. Die2 has K2 faces.
Die3 has K3 faces. All the dice are fair dice, so the prob...
分类:
其他好文 时间:
2015-03-18 18:08:58
阅读次数:
159
最近点对的裸题
利用分治去搞搞即可
代码:
#include
#include
#include
#include
using namespace std;
const int N = 100005;
struct Point {
double x, y;
void read() {
scanf("%lf%lf", &x, &y);
}
}...
分类:
其他好文 时间:
2015-03-16 21:19:59
阅读次数:
131
求圆和矩形面积交
还是三角剖分去做即可
代码:
#include
#include
#include
#include
#include
using namespace std;
const double eps = 1e-8;
const double pi = acos(-1.0);
int dcmp(double x)
{
if(x > eps) return 1;
...
分类:
其他好文 时间:
2015-03-16 19:23:51
阅读次数:
113
题意:有三个骰子,分别有k1,k2,k3个面。每次掷骰子,如果三个面分别为a,b,c则分数置0,否则加上三个骰子的分数之和。当分数大于n时结束。求游戏的期望步数。初始分数为0设dp[i]表示达到i分时到达目标状态(即i = n)的期望,pk为投掷k分的概率,p0为回到0的概率则dp[i] = ∑(p...
分类:
其他好文 时间:
2015-03-15 16:43:42
阅读次数:
127
zoj 2107 最近点对
题意:
给出n个点,求最近点对的距离/2。
限制:
2
思路:
点分治
/*zoj 2107
题意:
给出n个点,求最近点对的距离/2。
限制:
2 <= n <= 1e5
思路:
点分治
*/
#include
#include
#include
#include
using namespace std;
cons...
分类:
其他好文 时间:
2015-03-15 14:00:59
阅读次数:
133
Modular Inverse
Time Limit: 2 Seconds
Memory Limit: 65536 KB
The modular modular multiplicative inverse of an integer a modulo
m is an integer x such that a-1≡x (mod
m). This is equiv...
分类:
编程语言 时间:
2015-03-15 09:30:03
阅读次数:
207
超级神奇有趣题。AC自动机+数位DP。其实,数位DP在处理含有某些数字时特别不好处理,应该把它倒转为求不含有。这道题把数位DP+AC自动机结合起来,实在是很巧妙,把数字变为串来处理,强大!要使用AC自动机来处理数位DP,首先就是要确定哪些状态由当前状态开始是不可以到达的,有哪些是可以到达的。这是显而...
分类:
其他好文 时间:
2015-03-14 22:58:29
阅读次数:
258