上一页 1 ··· 4 5 6 7 8 9 10 11 12 ··· 18 下一页
View Code #include<stdio.h>#include<string.h>#include<algorithm>using namespace std;struct node{ int l, r;}p[303];bool vis[303];int n;bool cmp(node a, node b){ return a.r < b.r || a.r == b.r && a.l > b.l;}int main(){ int i, j, k; int ll, rr; while( ~scanf("%d&quo Read More
posted @ 2012-09-16 10:22 To be an ACMan Views(176) Comments(0) Diggs(0)
模拟题,每个字母代表一个数字,最多有五个字母,然后搜索一下即可。View Code #include<stdio.h>#include<string.h>#include<map>#include<algorithm>using namespace std;char s1[12], s2[12], s3[12];int a, b, c;int len1, len2, len3;int ans, num;bool vis[12];map<char, int> mm; // 表示映射,int表示 字母char是第几个加入map里面的,从1 Read More
posted @ 2012-09-16 10:18 To be an ACMan Views(212) Comments(0) Diggs(0)
题意:有一个二维(0,0)到(10,10)的区域,一个人从(0,0)开始一次拜访区域内的点,去找一样东西(就在这个区域内),每次他到达一个新的点后,都会有一句话,来告诉你是离那个东西更近了(Hotter),还是更远了(Colder),或者距离不变(Same),然后让你算出,这时那个东西可能处在的位置的区域的面积注意点:1. 这题主要搞清楚半平面要取到的区域,还有中垂线自己YY。小知识: 与直线ax+by+c=0垂直的直线方程为bx-ay+d = 0, 根据这个不用考虑斜率为0或不存在的问题,很方便。2. same以后的值都为0;其它 模板。模板1:View Code #include<s Read More
posted @ 2012-09-07 23:37 To be an ACMan Views(444) Comments(0) Diggs(0)
另一种模板View Code #include<stdio.h>#include<string.h>#include<algorithm>#include<vector>#include<math.h>using namespace std;#define eps 1e-8#define inf 1<<29struct point { double x, y; bool mark; point(){} point(double xx, double yy) : x(xx), y(yy), mark(1) {}};vecto Read More
posted @ 2012-09-07 14:17 To be an ACMan Views(238) Comments(0) Diggs(0)
水题,样例是错的,记得要考虑半平面交缩成一点, 水水就过了。View Code #include<stdio.h>#include<string.h>#include<math.h>#include<algorithm>using namespace std;struct point{ double x, y;}p[105], tp[105], pp[105];double a, b, c;int n, m;double r;void getline( point p1, point p2){ a = p2.y - p1.y; b = p1.x Read More
posted @ 2012-09-06 18:20 To be an ACMan Views(204) Comments(0) Diggs(0)
View Code #include<stdio.h>#include<string.h>#include<algorithm>#include<math.h>using namespace std;#define eps 1e-8#define inf 1<<29struct point{ double x, y;}p[105], tp[105], pp[105];double a, b, c;int n, m;void getline(point p1, point p2){ a = p2.y - p1.y; b = p1.x - Read More
posted @ 2012-09-06 16:31 To be an ACMan Views(186) Comments(0) Diggs(0)
模板题,没什么好说的。View Code #include<stdio.h>#include<string.h>#include<math.h>#include<algorithm>using namespace std;#define eps 1e-8struct point{ double x, y;}p[1505], tmp[1505], q[1505];double a, b, c;void get_line(point p1, point p2){ a = p2.y - p1.y; b = p1.x - p2.x; c = p2.x * Read More
posted @ 2012-09-06 10:20 To be an ACMan Views(157) Comments(0) Diggs(0)
POJ 3335 Rotating Scoreboard注意:题目给出的点集默认是顺时针的。View Code #include<stdio.h>#include<string.h>#include<math.h>#include<algorithm>using namespace std;struct point{ double x, y;}p[105], tmp[105], q[105];double a, b, c;void get_line(point p1, point p2){ a = p2.y - p1.y; b = p1.x - Read More
posted @ 2012-09-03 22:11 To be an ACMan Views(415) Comments(0) Diggs(0)
Pick公式:平面上以格子点为顶点的简单多边形,如果边上的点数为on,内部的点数为in,则它的面积为area=on/2+in-1利用gcd求每个边上的点数。View Code #include<stdio.h>#include<string.h>#include<math.h>#include<algorithm>#include<stdlib.h>using namespace std;struct point{ int x, y;}p[5];int gcd(int a, int b){ return b == 0 ? a : gc Read More
posted @ 2012-09-03 17:50 To be an ACMan Views(153) Comments(0) Diggs(0)
注意这题 多边形有凹有凸。水题。不解释View Code #include<stdio.h>#include<string.h>#include<math.h>#include<algorithm>#include<stdlib.h>#define lld __int64using namespace std;struct point{ lld x, y;}p[1000003];lld cal(int n, point *p){ int i; lld s = 0; p[n] = p[0]; for(i = 0; i < n; i Read More
posted @ 2012-09-03 17:00 To be an ACMan Views(197) Comments(0) Diggs(0)
上一页 1 ··· 4 5 6 7 8 9 10 11 12 ··· 18 下一页