代码改变世界

随笔档案-2012年7月7日

杨辉三角

2012-07-07 12:52 by javaspring, 131 阅读, 收藏,
摘要: public class yanghui { public static void main(String []args) { int [][]b=new int[10][]; for(int i=0;i<10;i++) b[i]=new int[i+1]; for(int i=0;i<10;i++) for(int j=0;j<=i;j++) { if(j==0||j==i) { b[i][j]=1; continue; } else { b[i][j]=b[i-1][j-1]+b[i-1][j]; } } for(int m=0;m<1... 阅读全文