13 条题解

  • 1
    @ 2025-5-25 17:55:00
    
    #include<iostream>
    using namespace std;
    int main(){
    	int n;
        int a[100][100]={};
    	cin>>n;
    	a[0][0]=1;
    	for(int i=1;i<=n;i++){
    		for(int j=1;j<=i;j++){
    			a[i][j]=a[i-1][j]+a[i-1][j-1];		
    		}
    	}
    	for(int i=1;i<=n;i++){
    		for(int j=1;j<=i;j++){
    			cout<<a[i][j]<<" ";		
    		}
    		cout<<endl;
    	}
    }
    
    • 1
      @ 2023-4-10 21:39:39
      #include<iostream>
      using namespace std;
      int a[35][35],n;
      int main(){
      	cin>>n;
      	a[1][1]=1;
      	for(int i=2;i<=n;i++)
      		for(int j=1;j<=n;j++)a[i][j]=a[i-1][j]+a[i-1][j-1];
      	for(int i=1;i<=n;i++){
      		for(int j=1;j<=i;j++)cout<<a[i][j]<<" ";
      		cout<<endl;
      	}
      	return 0;
      }
      
      • 0
        @ 2025-12-21 18:21:07

        #include <bits/stdc++.h> using namespace std; int n, y[45][45]; int main() { cin >> n; y[0][0] = 1; for(int i = 1; i <= n; i++) { for(int j = 1; j <= i; j++) { y[i][j] = y[i - 1][j] + y[i - 1][j - 1]; cout << y[i][j] << " "; } cout << endl; } return 0;
        }````

        • 0
          @ 2025-12-21 18:20:21

          #include <bits/stdc++.h> using namespace std; int n, y[45][45]; int main() { cin >> n; y[0][0] = 1; for(int i = 1; i <= n; i++) { for(int j = 1; j <= i; j++) { y[i][j] = y[i - 1][j] + y[i - 1][j - 1]; cout << y[i][j] << " "; } cout << endl; } return 0;
          }

          • 0
            @ 2025-1-24 13:09:35
            #include<bits/stdc++.h>
            using namespace std;
            const int N = 1e3 + 10;
            const int INF = 0x3f3f3f3f;
            int a[35][35],n;
            int main()
            {
            	cin >> n;
            	a[1][1]=1;
            	for(int i=2;i<=n;i++)
            	{
            		for(int j=1;j<=n;j++)
            		{
            			a[i][j]=a[i-1][j]+a[i-1][j-1];
            		}
            	}
            	for(int i=1;i<=n;i++)
            	{
            		for(int j=1;j<=i;j++)
            		{
            			cout<<a[i][j]<<" ";
            		}
            		cout<<endl;
            	}
            	return 0;
            }
            

            有标志认证,属三无产品,请大家放心食用

            • 0
              @ 2023-10-11 18:45:19
              #include<bits/stdc++.h>
              using namespace std;
              int n,m,sum=0;
              int main(){
              	cin>>n;
              	int a[n+2][n+2];
              	memset(a,0,sizeof(a));
              	a[1][1]=1;
              	for(int i=2;i<=n;i++){
              		for(int j=1;j<=n;j++){
              			a[i][j]=a[i-1][j]+a[i-1][j-1];
              		}
              	}
              	for(int i=1;i<=n;i++){
              		for(int j=1;j<=i;j++)cout<<a[i][j]<<" ";
              		cout<<endl;
              	}
              	return 0;
              }
              
              • 0
                @ 2023-4-9 18:42:40
                #include<iostream>
                using namespace std;
                int main()
                {
                    int n,a[213][213],i,j;
                    cin>>n;
                    for(i=0;i<=n-1;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];
                            cout<<a[i][j]<<" ";
                        }
                        cout<<"\n";
                    }
                    return 0;
                }
                
                • -1
                  @ 2025-5-11 9:18:09

                  #include<bits/stdc++.h> using namespace std; int a[100][100]; int main(){ int n; cin>>n; for(int i=1;i<=n;i++){ a[i][1]=a[i][i]=1; for(int j=2;j<=n;j++){ a[i][j]=a[i-1][j]+a[i-1][j-1]; } } for(int i=1;i<=n;i++){ for(int j=1;j<=i;j++){ cout<<a[i][j]<<' '; } cout<<endl; } return 0; }

                  • -1
                    @ 2024-11-17 18:53:47
                    #include<stdio.h>
                    #include<iostream>
                    using namespace std;
                    int a[1005][1005];
                    int main(){
                    	int n;
                    	cin>>n;
                    	a[1][1]=a[2][1]=a[2][2]=1;
                    	for(int i=3;i<=n;i++){
                    		a[i][1]=a[i][i]=1;
                    		for(int j=2;j<i;j++){
                    			a[i][j]=a[i=1][j=1]+a[i=1][j];
                    		}
                    	}
                    	for(int i=1;i<=n;i++){
                    		for(int j=1;j<=i;j++){
                    			cout<<a[i][j]<<" ";
                    		}
                    		cout<<endl;
                    	}
                    }
                    
                    • -1
                      @ 2024-10-25 18:26:17

                      6

                      #include <bits/stdc++.h>
                      using namespace std;
                      int a[40][40];
                      int n;
                      int main(){
                      	cin>>n;
                      	for(int i=1;i<=n;i++){
                      		for(int j=1;j<=n;j++){
                      			if(j==0||j==i){
                      				a[i][j]=1;
                      			}
                                  else{
                                  	a[i][j]=a[i-1][j-1]+a[i-1][j];
                      			}
                      		}
                      	}
                      	for(int i=1;i<=n;i++){
                      		for(int j=1;j<=i;j++){
                      			cout<<a[i][j]<<" ";
                      		}
                      		cout<<endl;
                      	}
                      	return 0;
                      }
                      
                      • -1
                        @ 2024-3-3 9:27:35

                        #include using namespace std; int a[40][40],n; int main() { cin>>n; a[0][1]=1; for(int i=1;i<=n;i++) { for(int j=1;j<=i;j++) { a[i][j]=a[i-1][j]+a[i-1][j-1]; cout<<a[i][j]<<" "; } cout<<endl; }

                        return 0;
                        

                        }

                        • -5
                          @ 2022-10-21 22:20:29

                          #include
                          #include
                          #include
                          #include
                          #include
                          #include
                          #include
                          #include
                          #include
                          #include
                          #include <bits/stdc++.h>
                          #define LL long long
                          const int N = 1e5 + 10;
                          const int INF = 0x3f3f3f3f;
                          using namespace std;
                          int main(){
                          int n,a[213][213],i,j;
                          cin>>n;
                          for(i=0;i<=n-1;i++)
                          {
                          for(j=0;j<=i;j++)
                          {
                          if(j0||ji) a[i][j]=1;
                          else a[i][j]=a[i-1][j-1]+a[i-1][j];
                          cout<<a[i][j]<<" ";
                          }
                          cout<<"\n";
                          }
                          return 0;
                          }

                          • -6
                            @ 2023-2-26 15:10:17

                            #include<bits/stdc++.h>

                            using namespace std;

                            int a[40][40];

                            int main(){

                            a[1][1] = 1;

                            int n;

                            cin>>n;

                            for(int i = 2; i <= n; i++ ){

                            for(int j = 1; j <= i; j++ ){

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

                            }

                            }

                            for(int i = 1; i <= n;i++ ){

                            for(int j = 1; j <= i;j++ ){

                            cout<<a[i][j]<<" ";

                            }

                            cout<<endl;

                            }

                            }

                            • 1

                            信息

                            ID
                            1078
                            时间
                            1000ms
                            内存
                            128MiB
                            难度
                            5
                            标签
                            递交数
                            743
                            已通过
                            302
                            上传者