码迷,mamicode.com
首页 >  
搜索关键字:math    ( 11719个结果
迭代算法求平方根
#include<stdio.h>#include<math.h>voidmain() { doublea,x0,x1;printf("inputa:\n");scanf("%lf",&a);if(a<0)printf("ERROR!\n");else { x0=a/2; x1=(x0+a/x0)/2;do { x0=x1; x1=(x0+a/x0)/2; }while(fabs(x0-x1)>=1e-6); }printf("Result:\n");printf(..
分类:编程语言   时间:2015-08-09 10:58:40    阅读次数:136
迭代算法求平方根
#include<stdio.h> #include<math.h> voidmain() { doublea,x0,x1; printf("inputa:\n"); scanf("%lf",&a); if(a<0)printf("ERROR!\n"); else { x0=a/2; x1=(x0+a/x0)/2; do { x0=x1; x1=(x0+a/x0)/2; }while(fabs(x0-x1)>=1e-6); } printf("Result:\n")..
分类:编程语言   时间:2015-08-09 10:57:36    阅读次数:101
迭代算法求平方根
#include<stdio.h> #include<math.h> voidmain() { doublea,x0,x1; printf("inputa:\n"); scanf("%lf",&a); if(a<0)printf("ERROR!\n"); else { x0=a/2; x1=(x0+a/x0)/2; do { x0=x1; x1=(x0+a/x0)/2; }while(fabs(x0-x1)>=1e-6); } printf("Result:\n")..
分类:编程语言   时间:2015-08-09 10:57:12    阅读次数:119
js timestamp与datetime之间的相互转换
1.  datetime转换成timestamp strdate = "2015-08-09 08:01:36:789"; var d = new Date(strdate); var timestamp=Math.round(d.getTime()); document.write("timestamp: "+timestamp+""); 输出: timestamp: 143...
分类:Web程序   时间:2015-08-09 09:31:27    阅读次数:139
JavaScript学习笔记——对象分类
对象的分类和内置Math对象一、对象的分类 1.内置对象 Global Math 2.本地对象 Array Number String Boolean Function R...
分类:编程语言   时间:2015-08-08 17:56:39    阅读次数:124
<JS中的数学计算>之简单实例讲解
1.取余数 %var a=10%3;//a=12.取绝对值 Math.abs()var a=Math.abs(-102.1);var b=Math.abs(102.1);//a=102.1;b=102.13.截取小数点后长度并进行四舍五入toFixed()var num_1 = new Numbe....
分类:Web程序   时间:2015-08-08 16:14:08    阅读次数:188
Codeforces Round #303 (Div. 2)(A,B,C,D)
A: 题目地址:Toy Cars 题意:给一个n*n的矩阵,-1只在对角线出现(因为自己不能撞自己),0代表没有车在碰撞,1代表第i辆车(横坐标)被撞坏了,2代表第j辆车(纵坐标)被撞坏了,3代表两辆车都撞坏了。问哪几辆车完好无损。 思路:遍历i。对每一行来说,只要有1和3就代表这辆车跪了,然后只要找出每一行没1和3的就好辣。#include #include <math....
分类:其他好文   时间:2015-08-08 13:36:19    阅读次数:81
Python -- 使用模块中的函数
在确定自己不会导入多个同名函数(从不同模块导入)的情况下,你可能不希望在每次调用函数的时候,都要写上模块的名字。那么,可以使用import命令的另外一种形式:>>> from math import sqrt>>> sqrt(9)3.0在使用了“from 模块 import 函数”这种形式的impo...
分类:编程语言   时间:2015-08-08 13:25:04    阅读次数:142
python -- 负数平方根-虚数的使用
负数的平方根是虚数。不能使用sqrt,因为它只能处理浮点数,而虚数是完全不同的——这也是由另外一个叫做cmath(即 complex math, 复数)的模块来实现这些功能的原因。>>> import cmath>>> cmath.sqrt(-1)1j注意,这里并没有使用 from ... impo...
分类:编程语言   时间:2015-08-08 13:21:56    阅读次数:472
jsp实现计算器
JavaBeanpackage com.itheima.domain;import java.math.BigDecimal;public class BigDecimalDemo { private double firstNum; private char fuHao='+'; private ...
分类:Web程序   时间:2015-08-07 23:43:17    阅读次数:176
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!