数学思想:利用圆方程和直线方程 已知两点坐标和半径求圆心坐标程序 #include <iostream> #include <fstream> #include <cmath> using namespace std; ofstream fout; typedef struct { double x; double y; }Point; double Y_Coordinates(double x,double y,double k,double x0);//4个参数…
[题目链接]:http://poj.org/problem?id=1981 [题意] 给你n个点(n<=300); 然后给你一个半径R: 让你在平面上找一个半径为R的圆; 这里R=1 使得这个圆覆盖的点的数目最多; [题解] 最少会有一个点; 考虑两个点的情况; 枚举任意两个点在圆上; 考虑最极端的情况; 就是这两个点都在圆的边上;(这样圆心就尽可能地远离它们俩了,以求让这个圆覆盖更多的点); 然后求出这个时候这时的圆心的坐标; 然后看看其他的在这个圆内的点的数目就好; 圆心的话只要求一边的圆心…
php代码:转载 http://www.cnblogs.com/caichenghui/p/5977431.html /** * 求两个已知经纬度之间的距离,单位为米 * * @param lng1 $ ,lng2 经度 * @param lat1 $ ,lat2 纬度 * @return float 距离,单位米 * @author www.Alixixi.com */ function getdistance($lng1, $lat1, $lng2, $lat2) { // 将角度转为狐度…
NX9+VS2012 #include <uf.h> #include <uf_ui.h> #include <uf_vec.h> #include <uf_curve.h> UF_initialize(); //创建直线1 UF_CURVE_line_t LineCoords1; LineCoords1.start_point[] = 0.0; LineCoords1.start_point[] = 0.0; LineCoords1.start_point…
一. 数学基础: 已知三角形的三边,计算三角形面积,需要用到海伦公式: 即p=(a+b+c)/2 二. 算法: 输入三个边长,套用海伦公式计算面积,并输出. 可以先判断是否可以构成三角形,即任意两边之和大于第三边,可以构成三角形情况下再计算,可以增加严谨性. 三. 代码: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 #include <stdio.h> #include <math.h> int main() {  printf("请依次输入三…
/** * @param {Number} _x1 A点坐标 * @param {Number} _y1 A点坐标 * @param {Number} _x2 B点坐标 * @param {Number} _y2 B点坐标 * @param {Number} _distance AC距离 */ function getPoint(_x1, _y1, _x2, _y2, _distance) { let curPoint = { x: _x1, y: _y1 }; let nextPoint =…
Pashmak has fallen in love with an attractive girl called Parmida since one year ago... Today, Pashmak set up a meeting with his partner in a romantic garden. Unfortunately, Pashmak has forgotten where the garden is. But he remembers that the garden…
至于为什么,上图.转载于MZW_BG 枚举正方形的一条边,此时有上正方形和下正方形. 最后正方形个数/4,因为每个正方形被枚举了4条边 #include <bits/stdc++.h> using namespace std; int x[509],y[509],vis[200][200]; bool ok(int x,int y) { if(x<-50||x>50||y<-50||y>50) return false; if(vis[x+50][y+50]==0) r…
#include <iostream> #include <cstring> #include <cstdio> using namespace std; ], zhongxu[]; void Print_(char* qian, char* zhong, int len){ char ch = *qian;//根节点 ) return ; ; for(; i<len; i++ ){ if( zhong[i] == *qian ) break ; } Print_…
采用的网址:https://my.oschina.net/boogoogle/blog/740478…