computer games
c | computer games



题目分析
只要存在一列上全部为1,就输出no;
代码
#include<iostream>
using namespace std;
int n, flag = 1;
int main()
{
int t;
cin >> t;
while (t--)
{
cin >> n;
flag = 1;
char squ[2][101];
for (int i = 0; i < 2; i++)
for (int j = 0; j < n; j++)
cin >> squ[i][j];
for (int j = 0; j < n; j++)
if (squ[0][j] == '1' && squ[1][j] == '1' && flag != 0)
{
flag = 0;
cout << "NO" << endl;
}
if (flag)
cout << "YES" << endl;
}
return 0;
}

浙公网安备 33010602011771号