上一页 1 ··· 92 93 94 95 96 97 98 99 100 ··· 182 下一页
摘要: 简单题View Code #include <iostream>#include <cstdio>#include <cstdlib>#include <cstring>using namespace std;#define maxn 10005int a, b, n;double p[maxn], sum[maxn];int dblcmp(double a, double b){ if (a < b) return -1; return 1;}int main(){ //freopen("t.txt", "r 阅读全文
posted @ 2011-08-02 12:36 undefined2024 阅读(409) 评论(0) 推荐(0)
摘要: 题意:给一个数列,两个栈,要求数列从后往前依次入栈,问能否使出栈序列是不减的。(双栈排序)分析:利用二分图染色法。首先观察那些牌绝对不能压入同一个栈,若两个不能入同一栈则连一条边,然后根据二分图染色,看是否能构成二分图。如果不能直接输出impossible两张牌i,j不能入同一栈的充要条件是,i>j>k(i最先入栈) && stock[k]<stock[i]<stock[j]然后根据每个点所染的颜色决定把每个牌压入哪个栈。然后模拟即可。View Code #include <iostream>#include <cstdio>#i 阅读全文
posted @ 2011-08-01 20:32 undefined2024 阅读(301) 评论(0) 推荐(1)
摘要: 简单题View Code #include <iostream>#include <cstdio>#include <cstdlib>#include <cstring>using namespace std;struct Point{ long long x, y;}first, last, now;int n;void input(){ printf("%d ", n); scanf("%lld%lld", &first.x, &first.y); last = first; for ( 阅读全文
posted @ 2011-08-01 16:07 undefined2024 阅读(419) 评论(0) 推荐(0)
摘要: 注意要用c++,精度问题注意有负数答案View Code #include <iostream>#include <cstdio>#include <cstdlib>#include <cstring>#include <cmath>using namespace std;#define maxn 35#define eps 10e-9int map[maxn * maxn];int n, m;double water, least;int dblcmp(double a, double b){ if (fabs(a - b) < 阅读全文
posted @ 2011-08-01 15:25 undefined2024 阅读(347) 评论(0) 推荐(0)
摘要: 题意:本题要求把一堆物品分成两堆,两堆总重量相差不到百分之2,即把物品进行背包,试着能否构成sum/(1 + 1.02)到sum/(1 + 1.02) * 1.02之间的一个数。分析:背包搜索,当要从若干个物品中选出一些的时候,每次递归最好不要单纯地枚举第i个物品是要还是不要,而是要用一个循环从上一个要的物品开始去枚举下一个物品要第几个。View Code #include <iostream>#include <cstdio>#include <cstdlib>#include <cstring>usingnamespace std;#defi 阅读全文
posted @ 2011-08-01 14:18 undefined2024 阅读(694) 评论(0) 推荐(0)
上一页 1 ··· 92 93 94 95 96 97 98 99 100 ··· 182 下一页