1 solutions

  • 0
    @ 2024-4-8 11:14:26

    #include using namespace std;

    int n,m;

    int a[105][105];

    int main(){ cin >> n >> m; for (int i=1;i<=n;i++) for (int j=1;j<=m;j++) cin >> a[i][j];

    int ans=0;
    for (int i=1;i<=n;i++)
    for (int j=1;j<=m;j++)
    	if (i==1||i==n||j==1||j==m)
    		ans += a[i][j];
    cout << ans << endl;
    

    }

    • 1

    Information

    ID
    6916
    Time
    1000ms
    Memory
    128MiB
    Difficulty
    1
    Tags
    # Submissions
    66
    Accepted
    44
    Uploaded By