摘要: 来源:http://wenku.baidu.com/view/9d2d5781d4d8d15abe234e35.html我是用到什么就敲什么,敲好了就放在这里备用#include #include #include #include #include using namespace std;const double EPS = 1e-9;const int MAXN = 40;struct Point3 //空间点{ double x, y, z; Point3( double x=0, double y=0, double z=0 ): x(x), y(y), z(z) { }... 阅读全文
posted @ 2013-07-26 19:20 冰鸮 阅读(576) 评论(0) 推荐(0)
摘要: 题意:给你一些无限长的圆柱,知道圆柱轴心直线(根据他给的三个点确定的平面求法向量即可)与半径,判断是否有圆柱相交。如果没有,输出柱面最小距离。一共只有30个圆柱,直接暴力一下就行。判相交/相切:空间直线距离是否小于等于两圆柱半径和若无相交,求最小:空间直线距离-两圆柱半径和 1 #include 2 #include 3 #include 4 #include 5 #include 6 7 using namespace std; 8 9 const double EPS = 1e-9; 10 const int MAXN = 40; 11 12 struct... 阅读全文
posted @ 2013-07-26 19:16 冰鸮 阅读(335) 评论(0) 推荐(0)
摘要: 感觉不是很好写的一道状态压缩。dp[i][j][k]表示第 i 行状态为k,第i - 1行状态为 j,具体细节见代码。内存卡的很死,要用滚动数组。还有一个比较坑爹的地方是它在输入蛋糕的时候中间可能会出现空行,一开始我用getchar()读,连第一组数据都过不去,后来改成scanf( "%s", str )才过……错了好多次。 1 #include 2 #include 3 #include 4 #include 5 6 using namespace std; 7 8 const int MAXN = 520; 9 const int INF = 1 0 && 阅读全文
posted @ 2013-07-26 16:20 冰鸮 阅读(428) 评论(0) 推荐(0)
摘要: 相当于从n-1个位置里面找k-1个位置放隔板 1 #include 2 #include 3 #include 4 #include 5 6 #define LL long long int 7 8 using namespace std; 9 10 int main()11 {12 double n, k;13 int T;14 scanf( "%d", &T );15 while ( T-- )16 {17 scanf( "%lf%lf", &n, &k );18 if ( n - k < k - 1 ) ... 阅读全文
posted @ 2013-07-26 11:43 冰鸮 阅读(202) 评论(0) 推荐(0)
摘要: 离散化的时候,排序后相邻点差值大于1的话需要加点。 1 #include 2 #include 3 #include 4 #include 5 6 #define lson l, m, rt > 1; 45 build(lson); 46 build(rson); 47 return; 48 } 49 50 void Update( int L, int R, int c, int l, int r, int rt ) 51 { 52 if ( L > 1; 59 if ( L m ) Update( L ,R, c, rson... 阅读全文
posted @ 2013-07-26 11:10 冰鸮 阅读(218) 评论(0) 推荐(0)