Description
n行数,一行6个,问这6*n个数里面是不是1~49都出现过
Algorithm
开个布尔数组记录下,然后每次出现就s++,最后看s是不是49
Hint
是Yes 不是 YES,搞得WA了一次
Code
#include <iostream>
using namespace std;
int n;
void solve()
{
bool b[50] = {false};
int s = 0;
for (int i = 0; i < n; i++)
for (int j = 0; j < 6; j++)
{
int x;
cin >> x;
if (!b[x])
{
b[x] = true;
s++;
}
}
if (s == 49) cout << "Yes" << endl; else cout << "No" << endl;
}
int main()
{
for (;;)
{
cin >> n;
if (n == 0) break;
solve();
}
}