上一页 1 ··· 117 118 119 120 121 122 123 124 125 ··· 182 下一页
摘要: 简单题View Code #include <iostream>#include <cstdio>#include <cstdlib>#include <cstring>using namespace std;int gcd(int x, int y){ if (!x || !y) return x > y ? x : y; for (int t; t = x % y; x = y, y = t) ; return y;}int main(){ //freopen("t.txt", "r", stdi 阅读全文
posted @ 2011-07-03 19:40 undefined2024 阅读(172) 评论(0) 推荐(0)
摘要: 题意:几何计算,给出一个管道(一条从左到右的折线,与它向下移动1后的折线构成),问管道最左边发出的光线所能到达的最远位置的横坐标是多少。分析:容易知道,要求一个能到达最远的光线,这条光线一定是经过至少两个折线的折点(每个这点可能是上面折线的,也可能是下面折线的),那么我们就每次枚举两个管道折点,求一直线看该直线与管道边缘线段交点。在求的过程中,可以从左到右依次判断是否与各个折点的横断面相交,然后可以得知是否会与管道壁相交。通过直线在横断面对应横坐标的位置的纵坐标高于还是低于横断面。可以判断其与那个管道壁相交,求交点即可。然后在所有交点中找一个横坐标最小的。View Code #include 阅读全文
posted @ 2011-07-03 16:29 undefined2024 阅读(1066) 评论(0) 推荐(0)
摘要: 简单题View Code #include <iostream>#include <cstdio>#include <cstdlib>#include <cstring>#include <cmath>using namespace std;#define maxn 105#define eps 10E-9#define inf 10000000struct Point{ double x, y, z, r;} point[maxn];double g[maxn][maxn];int vis[maxn], n;double lowc[ 阅读全文
posted @ 2011-07-03 09:40 undefined2024 阅读(320) 评论(0) 推荐(0)
摘要: 题意:给出若干个pie的半径,从这些pie中切出m个大小相等形状任意的块。可以剩余边角余料并扔掉。问每块最大多大。分析:这题是浮点数的二分题,二分每块的大小。由于pi要乘以一个较大数,所以精度要求较高,要用acos(-1.0)。这里eps只是在二分比较的时候用了,所以不用设置得太高。View Code #include <iostream>#include <cstdio>#include <cstdlib>#include <cstring>#include <cmath>usingnamespace std;#define max 阅读全文
posted @ 2011-07-03 09:00 undefined2024 阅读(533) 评论(0) 推荐(0)
摘要: 题意:给出膨胀指数,加热温度,杆子的原长度,问加热后的杆子两端点位置不变,弯曲成弧,圆心的位置。分析:二分答案,二分查找圆心位置,根据圆心位置计算出弧长与原弧长比较,不知道为什么wa那么多次。View Code #include #include #include #include #include usingnamespace std;#define eps 1.0e-8double c, l1, n;double cal(double b){ double a = l1 /2; double d = sqrt(a * a + b * b); double h = a * ... 阅读全文
posted @ 2011-07-02 21:22 undefined2024 阅读(401) 评论(0) 推荐(0)
上一页 1 ··· 117 118 119 120 121 122 123 124 125 ··· 182 下一页