{
  "type": "code_options",
  "author": "csdn.net",
  "source": "solution.md",
  "exercise_id": "93aef0d373dc44f58c0097b772693f6f",
  "keywords": "算法高阶,矩阵运算,矩阵求逆,算法问题选编",
  "title": "计算位于矩阵边缘的元素之和",
  "desc": [
    {
      "content": "\n描述\n输入一个整数矩阵，计算位于矩阵边缘的元素之和。所谓矩阵边缘的元素，就是第一行和最后一行的元素以及第一列和最后一列的元素。\n输入\n第一行分别为矩阵的行数m和列数n（m < 100，n < 100），两者之间以一个空格分开。\n接下来输入的m行数据中，每行包含n个整数，整数之间以一个空格分开。\n输出\n输出对应矩阵的边缘元素和\n样例输入\n3 3\n3 4 1\n3 7 1\n2 0 1\n样例输出\n15",
      "language": "markdown"
    }
  ],
  "answer": [
    {
      "content": "",
      "language": "cpp"
    }
  ],
  "prepared": [
    [
      {
        "content": "",
        "language": "cpp"
      }
    ],
    [
      {
        "content": "",
        "language": "cpp"
      }
    ],
    [
      {
        "content": "",
        "language": "cpp"
      }
    ]
  ],
  "template": {
    "content": "#include<stdio.h>\nint main()\n{\n\tint a[256][256];\n\tint n,m,i,j,sum=0;\n\tscanf(\"%d %d\",&n,&m);\n\tfor(i=1;i<=n;i++)\n\t{\n\t\tfor(j=1;j<=m;j++)\n\t\t{\n\t\t\tscanf(\"%d\",&a[i][j]);\n\t\t\tif (i == 1 || i == n || j == 1 || j == m) sum += a[i][j];\n\t\t}\n\t}\n\tprintf(\"%d\",sum);\n\treturn 0;\n}",
    "language": "cpp"
  },
  "node_id": "dailycode-6b6cb108231247e8a0d25180f162718b",
  "license": "csdn.net",
  "created_at": 1637894160,
  "topic_link": "https://bbs.csdn.net/topics/600470181"
}