摘要:
#include <cstdio>#include <iostream>using namespace std;int ans;void dfs(int n) { for (int i=1; i<=n/2; ++i) { ++ans; dfs(i); }}int main() { int n; while (scanf("%d", &n) != EOF) { ans = 1; dfs(n); printf ("%d\n", ans); } return 0;} 阅读全文
posted @ 2012-05-13 13:54
Try86
阅读(161)
评论(0)
推荐(0)
摘要:
#include <cstdio>#include <cstring>#include <iostream>using namespace std;const int N = 1005;char map[N][N], vis[N][N];struct node { int x; int y; int c;}Q[N*N], s, e;int front, rear;int dir[4][2] = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};int BFS(int n) { node first, next; front = rear 阅读全文
posted @ 2012-05-13 13:33
Try86
阅读(167)
评论(0)
推荐(0)
摘要:
#include <cmath>#include <cstdio>#include <iostream>using namespace std;double dis(double x1, double y1, double x2, double y2) { return sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));}int main() { double x1, y1, r1, x2, y2, r2; while (scanf("%lf%lf%lf%lf%lf%lf", &x1, &y1, 阅读全文
posted @ 2012-05-13 08:23
Try86
阅读(160)
评论(0)
推荐(0)
摘要:
/** 求简单多边形面积 */ #include <cstdio>#include <iostream>using namespace std;const int N = 105;struct point { int x; int y;}p[N];int crossProd(point A, point B) { return A.x*B.y - A.y*B.x;}int compArea(int n) { p[n] = p[0]; int area = 0; for (int i=0; i<n; ++i) area += crossProd(p[i], p[i+ 阅读全文
posted @ 2012-05-13 07:36
Try86
阅读(166)
评论(0)
推荐(0)
摘要:
/** 题意:求最多有多少个点共线 * 思路:枚举两点求直线,枚举有多少个点在直线上 */#include <cstdio>#include <iostream>using namespace std;const int N = 705;struct point { int x; int y;}p[N];int solve(int n) { int a, b, c, counts, ans = -1; for (int i=0; i<n; ++i) { for (int j=i+1; j<n; ++j) { a = p[j].y - p[i].y; //一般 阅读全文
posted @ 2012-05-13 07:26
Try86
阅读(279)
评论(0)
推荐(0)