{
  "type": "code_options",
  "author": "csdn.net",
  "source": "solution.md",
  "exercise_id": "28493fd954234d6bb0acc46411c635a3",
  "keywords": "算法初阶,基础知识,随机算法,概率分析和随机算法",
  "title": "难倒数万人的小学数学题",
  "desc": [
    {
      "content": "\n汉堡包在大街上大摇大摆的走着,看着手机上一道难倒数万人的小学数学题:\n1 + 1 = 0\n1 + 6 = 1\n6 + 6 = 2\n8 + 1 = 2\n8 + 6 = 3\n汉堡包看完之后发现上面这些加法的答案就是看1,6,8中圈圈的个数嘛！\n突然之间,所有大厦上的LED屏幕上的广告全部变成数字1,6,8三个数字的随机闪现。\n现给你一块n*m的LED屏幕，上面有且仅有一个数字(1,6,or 8)，请你输出你看见的那个字母。\n输入格式:\n第一行输入两个整数n，m(2<= m, n <= 1000)；\n接下来n行，每行由m个数字0和1组成，其中1表示数字1，6，8的组成部分。\n输出格式:\n输出一个整数，代表图形表示的数字。\n输入样例:\n7 7\n0 0 0 0 0 0 0\n0 0 1 1 1 0 0\n0 0 1 0 1 0 0\n0 0 1 1 1 0 0\n0 0 1 0 1 0 0\n0 0 1 1 1 0 0\n0 0 0 0 0 0 0\n输出样例:\n8",
      "language": "markdown"
    }
  ],
  "answer": [
    {
      "content": "",
      "language": "cpp"
    }
  ],
  "prepared": [
    [
      {
        "content": "",
        "language": "cpp"
      }
    ],
    [
      {
        "content": "",
        "language": "cpp"
      }
    ],
    [
      {
        "content": "",
        "language": "cpp"
      }
    ]
  ],
  "template": {
    "content": "#include <cstring>\n#include <algorithm>\n#include <iostream>\n#include <cstdio>\n#include <cmath>\n#include <stack>\n#include <queue>\nusing namespace std;\nint main(){\n\tint i,j,k=1;\n\tint n,m;\n\tint num[1010]={0};\n\tint num_cmp=0;\n\tint flag=1;\n\tint led[1005][1005];\n\tcin >> n >> m;\n\tfor(i=1;i<=n;i++){\n\t\tfor(j=1;j<=m;j++){\n\t\t\tcin >> led[i][j];\n\t\t\tif(led[i][j]==1)  num[k]++;\n\t\t}\n\t\tif(num[k]!=0)k++;\n\t}\n\tnum_cmp=num[k-1];\n\tfor(i=k-1;i>0;i--){\n\t\tif(num[i]<num_cmp) {\n\t\t\tflag++;\n\t\t\tnum_cmp=num[i];\n\t\t}\n\t}\n\tif(flag==1) cout <<\"1\"<<endl;\n\telse if(flag==2) cout <<\"8\"<<endl;\n\telse  cout <<\"6\"<<endl;\n\treturn 0;\n}",
    "language": "cpp"
  },
  "node_id": "dailycode-df624f99477f4489b3508b5d947545e6",
  "license": "csdn.net",
  "created_at": 1637894158,
  "topic_link": "https://bbs.csdn.net/topics/600470261"
}