3 solutions

  • 5
    @ 2024-7-13 11:38:43
    #include<bits/stdc++.h>
    using namespace std;
    const int N=100,M=100;
    int a[N][M];
    int main()
    {
    	int n,m,s=0;
    	cin>>n>>m;
    	for (int i=1;i<=n;i++)
    	{
    		for (int j=1;j<=m;j++)
    		{
    			cin>>a[i][j];
    		}
    	}
    	for (int i=1;i<=n;i++)
    	{
    		for (int j=1;j<=m;j++)
    		{
    			if (i==1 || i==n||j==1 || j==m)
    			{
    				s+=a[i][j];
    			}
    				
    		}
    	}
    	cout<<s;
    	return 0;
    }
    
    • @ 2024-7-13 11:40:42

      太有实力了

    • @ 2024-7-13 11:41:03

      必须支持

  • 0
    @ 2026-7-20 11:45:14
    #include <bits/stdc++.h>
    using namespace std;
    const int N=100,M=100;
    int a[N][M];
    int main()
    {
    	int n,m,s=0;
    	cin>>n>>m;
    	for(int i=1;i<=n;i++)
    	{
    		for(int j=1;j<=m;j++)
    		{
    			cin>>a[i][j];
    		}
    	}
    	for(int i=1;i<=n;i++)
    	{
    		for(int j=1;j<=m;j++)
    		{
    			if(i==1||i==n||j==1||j==m)
    			{
    				s+=a[i][j];
    			}
    		}
    	}
    	cout<<s;
    	return 0;
    }
    • -1
      @ 2025-3-13 20:25:08
      
      #include<bits/stdc++.h>
      using namespace std;
      const int N=1e2+10;
      int a[N][N];
      int main()
      {
          int n,m,cnt;
          cin>>n>>m;
          cnt=0;
          for(int i=1;i<=n;i++)
          {
              for(int j=1;j<=m;j++)
              {
                  cin>>a[i][j];
              }
          }
          for(int i=1;i<=n;i++)
          {
              for(int j=1;j<=m;j++)
              {
                  if(i==1
      • 1

      Information

      ID
      904
      Time
      1000ms
      Memory
      256MiB
      Difficulty
      1
      Tags
      (None)
      # Submissions
      124
      Accepted
      51
      Uploaded By