上一页 1 ··· 153 154 155 156 157 158 159 160 161 ··· 182 下一页
摘要: 题意:给定平面内的一些点,求平面内最多有几个点共线。分析:枚举两个点确定一条线段,把所有线段按照斜率排序,然后整理斜率相等的即可获得答案。View Code #include <iostream>#include <cstdio>#include <cstdlib>#include <cstring>#include <cmath>#include <algorithm>usingnamespace std;#define eps 1.0e-8#define maxn 205struct XPoint{ int x, y; 阅读全文
posted @ 2011-05-15 13:12 undefined2024 阅读(442) 评论(0) 推荐(0)
摘要: 高精度加法,putchar(),getchar()比scanf(),printf()快。效率相差10多倍。View Code #include <iostream>#include <cstdio>#include <cstdlib>#include <cstring>using namespace std;#define maxn 1000006int f1[maxn], f2[maxn];char ans[maxn];int main(){ //freopen("t.txt", "r", stdin); 阅读全文
posted @ 2011-05-15 12:00 undefined2024 阅读(212) 评论(0) 推荐(0)
摘要: 可以推公式也可以二分,我不会推公式,所以二分。这题之所以可以二分,是因为它符合一个性质,这个性质是,当你确定的a1偏大,利用a1求出的a[n+1]就偏大,大于题目中给出的a[n+1]。同理,偏小则小于。View Code #include <iostream>#include <cstdio>#include <cstdlib>#include <cstring>#include <cmath>using namespace std;#define maxn 3100#define eps 1.0e-8int n;double a[m 阅读全文
posted @ 2011-05-15 11:35 undefined2024 阅读(210) 评论(0) 推荐(0)
摘要: 大空间大时间的题,把4个数字分成两份,分别两两求和,得到两个长度n*n的一维数组,排序后比较进行匹配即可。View Code #include <iostream>#include <cstdio>#include <cstdlib>#include <cstring>#include <algorithm>using namespace std;#define maxn 4004int n;int f1[maxn * maxn];int f2[maxn * maxn];int a[maxn], b[maxn], c[maxn], d 阅读全文
posted @ 2011-05-14 21:23 undefined2024 阅读(911) 评论(0) 推荐(0)
摘要: 简单题,先从大到小排序,然后从两端开始向中间看看能不能把右端的匹配给左端。View Code #include <iostream>#include <cstdio>#include <cstdlib>#include <cstring>#include <algorithm>using namespace std;#define maxn 100005int n, m;int f[maxn];int cmp(int a, int b){ return a > b;}int main(){ //freopen("t.t 阅读全文
posted @ 2011-05-14 20:29 undefined2024 阅读(189) 评论(0) 推荐(0)
上一页 1 ··· 153 154 155 156 157 158 159 160 161 ··· 182 下一页