2 solutions

  • 1
    @ 2026-6-27 9:16:19
    #include<bits/stdc++.h>
    using namespace std;
    const int N=20,M=20;
    int a[N][M];
    int main()
    {
    	int n;
    	cin>>n;
    	for (int i=0;i<n;i++)
    	{
    		for (int j=0;j<n;j++)
    		{
    			cin>>a[i][j];
    		}
    	}
    	for (int i=0;i<n;i++)
    	{
    		for (int j=0;j<n;j++)
    		{
    			if (i==j||i+j==n-1)
    			{
    				a[i][j]+=10;
    			}
    		}
    	}
    	for (int i=0;i<n;i++)
    	{
    		for (int j=0;j<n;j++)
    		{
    			cout<<a[i][j]<<" ";
    		}
    		cout<<endl;
    	}
    	return 0;
    }
    
    • 0
      @ 2026-7-22 10:17:13

      位置

      • 1

      Information

      ID
      64
      Time
      1000ms
      Memory
      256MiB
      Difficulty
      1
      Tags
      (None)
      # Submissions
      132
      Accepted
      50
      Uploaded By