2 solutions

  • 0
    @ 2026-7-21 9:41:55
    #include <bits/stdc++.h>
    using namespace std;
    const int N=100,M=100;
    int a[N][M];
    int main()
    {
    	int n;
    	cin>>n;
    	for(int i=1;i<=n;i++)
    	{
    		for(int j=1;j<=n;j++)
    		{
    			cin>>a[i][j];
    		}
    	}
    	for(int i=1;i<=n;i++)
    	{
    		for(int j=1;j<=i;j++)
    		{
    			cout<<a[i][j]<<" ";
    		}
    		cout<<endl;
    	}
    	return 0;
    }

    Information

    ID
    2872
    Time
    1000ms
    Memory
    64MiB
    Difficulty
    5
    Tags
    # Submissions
    46
    Accepted
    17
    Uploaded By