/**
*
*/
package iSword;
/**
* @author chenguangjian/iSword 2013-3-30
*
*/
import iSword.data_basics;
public class calcu_base
{
/**
* @param args
*/
public static void main(String[] args)
{
// TODO Auto-generated method stub
calcu_base cb=new calcu_base();
cb.ratio_series(100, 8);
cb.three_digits();
}
/**
* 題目1:一球從100米高度自由落下,每次落地後反跳回原高度的一半;再落下,求它在 第10次落地時,共經過多少米?第10次反彈多高?
*/
public void ratio_series(double h,int n ){
double s=0;
double h0=h;
for(int i=1;i<n;i++){
s+=h;
h/=2;
}
data_basics db=new data_basics();
db.print("在"+h0+"米高空經過"+n+"次反彈經過路程:" + s+"\n");
db.print("在"+h0+"米高空經過"+n+"次反彈後的高度:" + h/2+"\n");
}
/**
* 題目:有1、2、3、4四個數字,能組成多少個互不相同且無重複數字的三位數?都是多少?
*/
public void three_digits(){
int count=0;
data_basics db=new data_basics();
for (int a=1;a<=4;a++){
for(int b=1;b<=4;b++){
for (int c=1;c<=4;c++){
if(a!=b && b!=c && c!=a){
count++;
//int m=a*100+b*10+c;
db.print(String.valueOf(a*100+b*10+c)+",");
}
}
}
}
db.print("\n 用1、2、3、4四個數字,能組成多少個互不相同且無重複數字的三位數共有" + count + "個三位數");
}
}
輸出:在100.0米高空經過8次反彈經過路程:198.4375
在100.0米高空經過8次反彈後的高度:0.390625
123,124,132,134,142,143,213,214,231,234,241,243,312,314,321,324,341,342,412,413,421,423,431,432,
用1、2、3、4四個數字,能組成多少個互不相同且無重複數字的三位數共有24個三位數