自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(7)
  • 收藏
  • 关注

原创 [几何]点在直线上的垂足

double dotMulti(Point e1,Point e2,Point s=org){ return ((e1.x-s.x)*(e2.x-s.x)+(e1.y-s.y)*(e2.y-s.y));}double dist(Point a,Point b=org){ return sqrt(pow(a.x-b.x,2)+pow(a.y-b.y,2));}double relation(

2008-11-05 15:42:00 545

原创 zju1010判断直线相交,求多边形面积

 #include#includeusing namespace std;const int MAX=1001;const double EPS=1e-10;struct Point{ double x,y; Point(double a=0,double b=0):x(a),y(b){} bool operator == (Point &right) {  return (fabs(x-ri

2008-10-30 16:13:00 425

原创 zju1032

一条直线((0,0),(n,m))上的格点数(包含端点)等于n与m的最大公约数+1皮克定理: 面积A和内部格点数目i、边上格点数目b的关系:A = i + b/2 - 1 #include#includestruct Point{ int x,y; Point(int a=0,int b=0):x(a),y(b){}};Point point[100],org;int size

2008-10-30 16:12:00 268

原创 矩阵求A^k,A+A^2+A^3+……A^k

void pow(int k,Matrix a){ tpow=e;                        //e为单位矩阵    for(;k;a=a*a,k>>=1)  if(k&1)tpow=tpow*a;}Matrix sum(int k,Matrix a){ if(k==1) return a; Matrix tmp=sum(k/2,a); if(k&1) {  pow(k/2

2008-10-26 11:51:00 1668

原创 2235

#include#include#includestruct Node{ int x,y; int peanuts;};int compare(const void* a,const void* b){ Node* m = (Node*) a; Node* n = (Node*) b; return n->peanuts-m->peanuts;}int main(){ const int

2008-10-07 20:53:00 356

原创 1225

#include#include#includestruct foralph{ char* origin; char* upper;};int comparenum(const void* a,const void* b){ int* m=(int*)a; int* n=(int*)b; return *m-*n;}int comparealph(const void* a,const

2008-10-07 20:51:00 254

原创 最近点对

最近的点对要不是x方向相邻,就是y方向相邻。分别按x,y方向排序,依次求距离,取最小的。#include#include#include#includeusing namespace std;struct Point{ double x,y;};bool basedX(Point& a,Point& b){ return a.x }bool basedY(Point& a,Point& b){ r

2008-05-10 16:39:00 279

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除