蓝桥杯 BASIC 23 芯片测试(基

【思路】:需要用手写一下。如下图一目了然。

【AC代码】:

#include <iostream>#include <algorithm>#include <iomanip>#include <cstdio>#include <cstring>using namespace std;#define MAX 20+2int test[MAX][MAX];char str[MAX][MAX];int cnt[MAX];int main(){//freopen("in.txt", "r", stdin);//freopen("out.txt", "w", stdout);int n = 0, i = 0, j = 0;//inputcin >> n;if (2 == n){cout << 1 << " " << 2;return 0;}for (i = 0; i < n; i++){for (j = 0; j < n; j++)cin >> test[i][j];}//transfor (i = 0; i < n; i++){for (j = 0; j < n; j++){str[i][j] = test[i][j]+'0';}str[i][j] = '\0';}//cntfor (i = 0; i < n; i++){for (j = 0; j < n; j++){if (!strcmp(str[i], str[j]))cnt[i]++;}}//outputint max = -1, pos = -1;for (i = 0; i < n; i++){if (cnt[i] > max){max = cnt[i];pos = i;}}for (i = 0; i < n; i++)if ('1' == str[pos][i])cout << i+1<< " ";}

,靠山山会倒,靠人人会跑,只有自己最可靠。

蓝桥杯 BASIC 23 芯片测试(基

相关文章:

你感兴趣的文章:

标签云: