摘要:
简单题View Code #include <iostream>#include <cstdlib>#include <cstring>#include <cstdio>using namespace std;#define maxl 1005#define maxn 30int f[maxn], g[maxn];char a[maxl], b[maxl];void make(char *st, int f[]){ int len = strlen(st); for (int i = 0; i < len; i++) f[st[i] - & 阅读全文
posted @ 2011-10-03 17:56
undefined2024
阅读(207)
评论(0)
推荐(0)
摘要:
简单题View Code #include <iostream>#include <cstdlib>#include <cstring>#include <cstdio>using namespace std;struct Point{ double x, y;} point[5];void input(){ for (int i = 1; i < 4; i++) scanf("%lf%lf", &point[i].x, &point[i].y); if (point[1].x != point[2].x 阅读全文
posted @ 2011-10-03 17:37
undefined2024
阅读(176)
评论(0)
推荐(0)
摘要:
题意:给出p,q,r,s,求c(p,q)/c(r,s)分析:利用组合数公式,写出整体的分子和分母(用数组标记,分子分母各有哪些数),把相同的数字约去。然后把分子乘上,分母除掉。但是这样直接乘除会损失精度。所以我们定义double ans = 1;然后当ans<1时算乘法,ans>=1时算除法,以控制ans始终在1不会和1相差10000倍以上,以保证精度。View Code #include <iostream>#include <cstdlib>#include <cstring>#include <cstdio>using name 阅读全文
posted @ 2011-10-03 15:15
undefined2024
阅读(159)
评论(0)
推荐(0)
摘要:
最短路View Code #include <iostream>#include <cstdlib>#include <cstring>#include <cstdio>using namespace std;#define maxf 105#define maxn 505#define inf 0x3f3f3f3fint firenum, n;int fire[maxf];int map[maxn][maxn];int firedist[maxn];void input(){ scanf("%d%d", &firen 阅读全文
posted @ 2011-10-03 13:58
undefined2024
阅读(257)
评论(0)
推荐(0)
摘要:
打表View Code #include <iostream>#include <cstdlib>#include <cstring>#include <cstdio>using namespace std;#define maxn 35005int n;int pre[maxn], next[maxn];void del(int a){ pre[next[a]] = pre[a]; next[pre[a]] = next[a];}void init(){ n = 35000; for (int i = 0; i < n; i++) { p 阅读全文
posted @ 2011-10-03 13:24
undefined2024
阅读(196)
评论(0)
推荐(0)