zoukankan      html  css  js  c++  java
  • 杨辉三角

    public class yanghui {  

                          public static void main(String args[]){   

                                    int[][] a; 

                                     a=new int [5][5];   

                                      int i,j;  

                                       for(i=0;i<5;i++){    

                                                              for(j=0;j<=i;j++){    

                                                                            if(j==0||j==i)     

                                                                                 a[i][j]=1;        

                                                                        else     

                                                                       a[i][j]=a[i-1][j-1]+a[i-1][j];        

                                                                       System.out.print(a[i][j]+"") ;}     

                                                                        System.out.print(" ");   

     }      

     }  

    }

  • 相关阅读:
    [CF1398E] Two Types of Spells
    [CF1399E2] Weights Division (hard version)
    [CF1400E] Clear the Multiset
    Review 2020.10.29
    Review 2020.10.11
    [CF1409F] Subsequences of Length Two
    [CF1413E] Solo mid Oracle
    [2020CCPC威海C] Rencontre
    [2020CCPC威海B] Labyrinth
    phpredis实现简单的消息队列
  • 原文地址:https://www.cnblogs.com/fangfuyingcom/p/6795599.html
Copyright © 2011-2022 走看看