# 难倒数万人的小学数学题

汉堡包在大街上大摇大摆的走着,看着手机上一道难倒数万人的小学数学题:

```json
1 + 1 = 0
1 + 6 = 1
6 + 6 = 2
8 + 1 = 2
8 + 6 = 3
```

汉堡包看完之后发现上面这些加法的答案就是看1,6,8中圈圈的个数嘛！

突然之间,所有大厦上的LED屏幕上的广告全部变成数字1,6,8三个数字的随机闪现。

现给你一块n*m的LED屏幕，上面有且仅有一个数字(1,6,or 8)，请你输出你看见的那个字母。

**输入格式:**

第一行输入两个整数n，m(2<= m, n <= 1000)；

接下来n行，每行由m个数字0和1组成，其中1表示数字1，6，8的组成部分。

**输出格式:**

输出一个整数，代表图形表示的数字。

**输入样例:**

```json
7 7
0 0 0 0 0 0 0
0 0 1 1 1 0 0
0 0 1 0 1 0 0
0 0 1 1 1 0 0
0 0 1 0 1 0 0
0 0 1 1 1 0 0
0 0 0 0 0 0 0
```

**输出样例:**

```json
8
```

以下程序实现了这一功能，请你填补空白处内容：

```cpp
#include <cstring>
#include <algorithm>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <stack>
#include <queue>
using namespace std;
int main()
{
    int i, j, k = 1;
    int n, m;
    int num[1010] = {0};
    int num_cmp = 0;
    int flag = 1;
    int led[1005][1005];
    cin >> n >> m;
    for (i = 1; i <= n; i++)
    {
        for (j = 1; j <= m; j++)
        {
            cin >> led[i][j];
            if (led[i][j] == 1)
                num[k]++;
        }
        if (num[k] != 0)
            k++;
    }
    num_cmp = num[k - 1];
    ______________________;
    if (flag == 1)
        cout << "1" << endl;
    else if (flag == 2)
        cout << "8" << endl;
    else
        cout << "6" << endl;
    return 0;
}
```

## template

```cpp
#include <cstring>
#include <algorithm>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <stack>
#include <queue>
using namespace std;
int main()
{
    int i, j, k = 1;
    int n, m;
    int num[1010] = {0};
    int num_cmp = 0;
    int flag = 1;
    int led[1005][1005];
    cin >> n >> m;
    for (i = 1; i <= n; i++)
    {
        for (j = 1; j <= m; j++)
        {
            cin >> led[i][j];
            if (led[i][j] == 1)
                num[k]++;
        }
        if (num[k] != 0)
            k++;
    }
    num_cmp = num[k - 1];
    for (i = k - 1; i > 0; i--)
    {
        if (num[i] < num_cmp)
        {
            flag++;
            num_cmp = num[i];
        }
    }
    if (flag == 1)
        cout << "1" << endl;
    else if (flag == 2)
        cout << "8" << endl;
    else
        cout << "6" << endl;
    return 0;
}
```

## 答案

```cpp
for (i = k - 1; i > 0; i--)
{
	if (num[i] < num_cmp)
	{
		flag++;
		num_cmp = num[i];
	}
}
```

## 选项

### A

```cpp
for (i = k - 1; i > 0; i--)
{
	if (num[i] < num_cmp)
	{
		flag++;
	}
}
```

### B

```cpp
for (i = k - 1; i > 0; i--)
{
	if (num[i] < num_cmp)
	{
		num_cmp = num[i];
	}
}
```

### C

```cpp
for (i = k - 1; i > 0; i--)
{
	if (num[i] > num_cmp)
	{
		flag++;
		num_cmp = num[i];
	}
}
```