中学的 又用上了。 1 #include 2 #include 3 #include 4 5 using namespace std; 6 7 int x1,y1,x2,y2,x3,y3,x4,y4; 8 double k1,k2,k3,d1,d2; 9 double x,y;10 11 ...
分类:
其他好文 时间:
2014-07-24 22:40:53
阅读次数:
398
public class Demo1{ public static void main(String args[]) { //byte<short<int<long<float<double //低进度转高精度,自动转换 double a = 3; System.out.println(a)...
分类:
其他好文 时间:
2014-07-24 22:36:23
阅读次数:
173
不懂得见算法背包问题详解
代码如下:
#include
struct node
{
int cost;
double wei;
} a[10004];
double min(double a,double b)
{ return a>b? b:a;}
int main()
{
int i,j,n,m;
double dp[10004];
whil...
分类:
其他好文 时间:
2014-07-24 17:44:25
阅读次数:
235
UVA 474 - Heads / Tails Probability
题目链接
题意:给定n,求出2?n的科学计数法
思路:水水的,n最多到100w,那么先递推预处理出答案,然后输出即可
代码:
#include
#include
const int N = 1000001;
const double eps = 1e-9;
int n;
struct Ans...
分类:
其他好文 时间:
2014-07-24 10:39:54
阅读次数:
234
#include #define CPU_F ((double)12000000)//cpu frequency12000000#define delay_us(x) __delay_cycles((long)(CPU_F*(double)x/1000000.0))#define delay_ms(...
分类:
其他好文 时间:
2014-07-23 20:53:15
阅读次数:
221
工具类 ,直接就可以使用,对于float和double的进行加减乘除长生的误差的解决办法。import java.math.BigDecimal;public class Arith {// 默认除法运算精度private static final int DEF_DIV_SCALE = 10;//...
分类:
其他好文 时间:
2014-07-23 20:44:15
阅读次数:
206
1 //经纬度转Wev墨卡托 2 dvec3 CMathEngine::lonLat2WebMercator(dvec3 lonLat) 3 { 4 dvec3 mercator; 5 double x = lonLat.x *20037508.34/180; 6 do...
分类:
Web程序 时间:
2014-07-23 20:38:25
阅读次数:
217
最近犯了一个错误:定义变量类型的时候竟然定义了unsigned double的类型。由于编译能够通过,因此一直没有发现这样写会有什么样的问题。今天一次偶然的测试中发现这些变量的值都是整数。一开始觉得奇怪,明明是浮点数,怎么变成整型了?后来上网查了一下资料:原来浮点数是不能用 unsigned来规范的...
分类:
其他好文 时间:
2014-07-23 15:06:56
阅读次数:
222
Another Double pointer solution. 1A!class Solution {public: ListNode *removeNthFromEnd(ListNode *head, int n) { ListNode *p = NULL; ...
分类:
其他好文 时间:
2014-07-23 14:52:16
阅读次数:
176
好多情况我们需要把一个地方的经纬度存到数据库,也就是根据地址通过GoogleMap查询出来其对应的经纬度。 public static double[] getCoordinate(String addr) { double[] latLng = new double[2]; String addres...