上一页 1 ··· 70 71 72 73 74 75 76 77 78 ··· 182 下一页
摘要: 模拟View Code #include <iostream>#include <cstdlib>#include <cstring>#include <cstdio>using namespace std;#define maxn 1005int n, m;int pos[maxn];void work(){ int a = n; int b = m; int cnt = 1; int i = 1; pos[a] = 0; putchar('.'); while (true) { int temp = a * 10 / b; . 阅读全文
posted @ 2011-09-21 09:58 undefined2024 阅读(165) 评论(0) 推荐(0)
摘要: floyd+几何计算线段相交View Code #include <iostream>#include <cstdlib>#include <cstring>#include <cstdio>using namespace std;#define maxn 20#define zero(x) (((x)>0?(x):-(x))<eps)#define eps 1.0E-8struct Point{ double x, y;};struct Line{ Point a, b;} straw[maxn];bool g[maxn][maxn 阅读全文
posted @ 2011-09-19 20:57 undefined2024 阅读(197) 评论(0) 推荐(0)
摘要: 注意输入1 2的情况,第一个结果为1/1,而不是0/1。题中没说,但是实际上要求对于同一个分母有两个同样好的分子时,取较大的。View Code #include <iostream>#include <cstdlib>#include <cstring>#include <cstdio>using namespace std;struct Elem{ int a, b; bool operator <=(const Elem &x) { return this->a * (long long) x.b <= x.a * 阅读全文
posted @ 2011-09-19 16:26 undefined2024 阅读(309) 评论(0) 推荐(0)
摘要: 题意:给出图中所有线段,和一个点,问这个点要出正方形至少穿越多少线。分析:所有线段端点都在正方形周边线上。走弯路是无意义的,不会使穿过的墙减少,因为线段都是接边界的,无法绕过。我们枚举周边线上的出口,连直线,看最少有几个交点。因为只有跨越端点的时候才会改变交点数量。所以我们只需在每两个端点间枚举一个点。View Code #include <iostream>#include <cstdlib>#include <cstring>#include <cstdio>#include <algorithm>#include <cma 阅读全文
posted @ 2011-09-19 13:58 undefined2024 阅读(616) 评论(0) 推荐(0)
摘要: 简单枚举View Code #include <iostream>#include <cstdlib>#include <cstring>#include <cstdio>using namespace std;char card[20][10];int n;int m;bool found;bool ok(char a, char b, char c){ if (a == b && b == c) return true; if (a == b || b == c || c == a) return false; return 阅读全文
posted @ 2011-09-19 09:50 undefined2024 阅读(230) 评论(0) 推荐(0)
上一页 1 ··· 70 71 72 73 74 75 76 77 78 ··· 182 下一页