2014
03-02

# Fred’s Lotto Tickets

Fred likes to play the lotto. Whenever he does, he buys lots of tickets. Each ticket has 6 unique numbers in the range from 1 to 49, inclusive. Fred likes to “Cover all his bases." By that, he means that he likes for each set of lottery tickets to contain every number from 1 to 49, at least once, on some ticket. Write a program to help Fred see of his tickets “Cover all the bases."

The input file consists of a number of test cases. Each case starts with an integer N ( 1<=N<=100 ), indicating the number of tickets Fred has purchased. On the next N lines are the tickets, one per line. Each ticket will have exactly 6 integers, and all of them will be in the range from 1 to 49 inclusive. No ticket will have duplicate numbers, but the numbers on a ticket may appear in any order. The input ends with a line containing only a 0′.

The input file consists of a number of test cases. Each case starts with an integer N ( 1<=N<=100 ), indicating the number of tickets Fred has purchased. On the next N lines are the tickets, one per line. Each ticket will have exactly 6 integers, and all of them will be in the range from 1 to 49 inclusive. No ticket will have duplicate numbers, but the numbers on a ticket may appear in any order. The input ends with a line containing only a 0′.

1
1 2 3 4 5 6
9
1 2 3 4 5 6
10 9 8 7 12 11
13 14 15 16 17 18
19 20 21 22 23 24
25 26 27 28 29 30
31 32 33 34 35 36
37 38 39 40 41 42
43 44 45 46 47 48
49 19 34 27 25 13
0

No
Yes

PS:题目意思是判断输入的数字是否将1-49全包含进去，如果说输出Yes 否则 No

#include<stdio.h>
#include<string.h>
int main()
{
int i,j,n,a[111][6],aa[50];

while(scanf("%d",&n),n!=0)
{
for(i=1;i<50;i++)
aa[i]=i;aa[0]=0;
for(i=0;i<n;i++)
for(j=0;j<6;j++)
{
scanf("%d",&a[i][j]);
aa[a[i][j]]=0;
}
for(i=1;i<50;i++)
if(aa[i]!=0) break;
if(i==50)printf("Yes\n");
else printf("No\n");
}
return 0;
}

1. 站长好。我是一个准备创业的互联网小白,我们打算做一个有关国*际*游*学的平台。手上也有了一些境外资源。现阶段的团队现在没有cto.原意出让一些管理股寻找一个靠谱的技术专家做合伙人, 不知道是不是能得到您的帮助。发个帖子或者其他方式。期待您的回应。可以加我微信tianxielemon聊聊。

2. 因为是要把从字符串s的start位到当前位在hash中重置，修改提交后能accept，但是不修改居然也能accept

3. 可以参考算法导论中的时间戳。就是结束访问时间，最后结束的顶点肯定是入度为0的顶点，因为DFS要回溯