码迷,mamicode.com
首页 >  
搜索关键字:math    ( 11719个结果
用c语言计算1/1-1/2+1/3-1/4+1/5-...+1/99-1/100
计算1/1-1/2+1/3-1/4+1/5-...+1/99-1/100。方法一:计算1/1-1/2+1/3-1/4+1/5-...+1/99-1/100#include<stdio.h>#include<math.h>main(){floatsum=0.0;floatn=0;floata=0.0;for(n=1;n<101;n++){a=pow(-1,n+1);sum=a/n+sum;}printf("%f",sum);return0;}方法二:(..
分类:编程语言   时间:2015-09-23 01:26:36    阅读次数:465
c语言初级小程序
1.打印100-200之间的素数:#include<stdio.h>#include<math.h>intmain(){inti,a;for(i=101;i<200;i++){for(a=2;a<=sqrt(i);a++)if(i%a==0)break;if(i%a!=0)printf("%d\n",i);}return0;}2.输入乘法口诀:#include<stdio.h>intmain(){inti,j;for(i=1;i&l..
分类:编程语言   时间:2015-09-23 01:17:59    阅读次数:153
用c输出100--200之间的素数
#include<stdio.h>#include<math.h>intmain(){inti,j,flag;for(i=100;i<=200;i++){flag=1;for(j=2;j<=sqrt(i);j++)if(i%j==0)flag=0;if(flag==1)printf("%d\t",i);}return0;}
分类:其他好文   时间:2015-09-22 19:11:49    阅读次数:119
c语言打印100~200之间的素数
素数即就是该数除了1和它本身以外不再有其他的因数,否则称为合数。找寻100~200之间的素数的算法:让a被2~√a除,若a不能被整除,则a是素数。#include<stdio.h> #include<math.h> intmain() { inta,k,i;//数a printf("100~200以内的prime\n"); for(a=101;a<=200..
分类:编程语言   时间:2015-09-22 19:11:04    阅读次数:147
定点瞄准算法
import org.robochina.airobot.tank.*;import org.robochina.math.*;import java.awt.geom.*;import java.util.*;/** * 这个类对应一个机器人,根据需要实现相应的Action处理函数, * 就可以订...
分类:编程语言   时间:2015-09-22 18:12:14    阅读次数:201
js 地图坐标转换
火星坐标转百度坐标function gcj02_to_bd09(lng, lat) { var z = Math.sqrt(lng * lng + lat * lat) + 0.00002 * Math.sin(lat * Math.PI); var theta = Math.atan2...
分类:Web程序   时间:2015-09-22 16:29:21    阅读次数:207
随机验证码生成
1 public static void CreateValidateGraphic(string validateCode, HttpContext httpContext) 2 { 3 Bitmap img = new Bitmap((int)Math.Ceiling(...
分类:其他好文   时间:2015-09-22 16:23:38    阅读次数:217
有移动规则2
import org.robochina.airobot.tank.*;import org.robochina.math.*;import java.awt.geom.*;import java.util.*;/** * 这个类对应一个机器人,根据需要实现相应的Action处理函数...
分类:移动开发   时间:2015-09-22 13:02:18    阅读次数:176
Javascript 随机数 int 范围一个数 float
1.随机取int范围一个数,比如0-3中取0,1,2,3,同时包含0和3 var rand = {}; rand.getInt = function (begin,end){ return Math.floor(Math.random()*(end-begin + 1)) + begin; } var v = rand.getInt(0,3) alert(v); 常见错误写法: v...
分类:编程语言   时间:2015-09-22 11:33:15    阅读次数:191
LeetCode Dungeon Game
原题链接在这里:https://leetcode.com/problems/dungeon-game/这是一道DP题,保存当前格到右下格所需要的最小体力,m*n的dp数组保存。更新是Math.min(走右侧最小体力,左下侧最小体力).走右侧最小体力 = Math.max(dp[i][j+1]- du...
分类:其他好文   时间:2015-09-22 06:39:17    阅读次数:147
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!