# 114 程式設計實習I (資訊一乙) Week02 作業
## **皆為 CPE 歷屆考題**
## 1. B2-Sequence
### Description
所謂「B2數列」係指一正整數數列 1<= b1 < b2 < b3 ...,其中所有的 bi + bj (i <= j)皆不相等。
您的任務是判別某一數列是否為「B2數列」。
A B2-Sequence is a sequence of positive integers 1 ≤ b1 < b2 < b3 . . . such that all pairwise sums bi +bj ,
where i ≤ j, are different.
Your task is to determine if a given sequence is a B2-Sequence or not
### Input
每筆測試資料有兩行,第一行代表該數列有 N 個數值(2 ≤ N ≤ 100),第二行則為該數列的N個數值。每個數值 bi 皆為整數,且 bi ≤ 10000。
Each test case starts with 2 ≤ N ≤ 100, the number of elements in a sequence. Next line will have N
integers, representing the value of each element in the sequence. Each element bi
is an integer such that
bi ≤ 10000. There is a blank line after each test case. The input is terminated by end of file (EOF).
### Output
每筆測試資料以一行輸出,且每筆輸出資料後均需輸出一空白行。格式請參考輸出範例。
For each test case you must print the number of the test case, starting from 1, and a message indicating
if the corresponding sequence it is a B2-Sequence or not. See the sample output below. After each test
case you must print a blank line.
### Sample Input 1
```c
4
1 2 4 8
4
3 7 10 14
5
13 14 15 16 17
```
### Sample Output 1
```c
Case #1: It is a B2-Sequence.
Case #2: It is not a B2-Sequence.
Case #3: It is not a B2-Sequence.
```
## 2. Lotto
### Description
In the German Lotto you have to select 6 numbers from the set {1,2,...,49}. A popular strategy to play Lotto - although it doesn’t increase your chance of winning — is to select a subset S containing k(k > 6) of these 49 numbers, and then play several games with choosing numbers only from S.
For example, for k = 8 and S = {1, 2, 3, 5, 8, 13, 21, 34} there are 28 possible games: [1,2,3,5,8,13],
[1,2,3,5,8,21], [1,2,3,5,8,34], [1,2,3,5,13,21], ..., [3,5,8,13,21,34].
Your job is to write a program that reads in the number k and the set S and then prints all possible games choosing numbers only from S.
### Input
The input file will contain one or more test cases.
Each test case consists of one line containing several integers separated from each other by spaces.
The first integer on the line will be the number k (6 < k < 13). Then k integers, specifying the set S will follow in ascending order.
Input will be terminated by a value of zero (0) for k.
### Output
For each test case, print all possible games, each game on one line.
The numbers of each game have to be sorted in ascending order and separated from each other by exactly one space. The games themselves have to be sorted lexicographically, that means sorted by the lowest number first, then by the second lowest and so on, as demonstrated in the sample output below.
The test cases have to be separated from each other by exactly one blank line. Do not put a blank line after the last test case.
### Sample Input 1
```c
7 1 2 3 4 5 6 7
8 1 2 3 5 8 13 21 34
0
```
### Sample Output 1
```c
1 2 3 4 5 6
1 2 3 4 5 7
1 2 3 4 6 7
1 2 3 5 6 7
1 2 4 5 6 7
1 3 4 5 6 7
2 3 4 5 6 7
1 2 3 5 8 13
1 2 3 5 8 21
1 2 3 5 8 34
1 2 3 5 13 21
1 2 3 5 13 34
1 2 3 5 21 34
1 2 3 8 13 21
1 2 3 8 13 34
1 2 3 8 21 34
1 2 3 13 21 34
1 2 5 8 13 21
1 2 5 8 13 34
1 2 5 8 21 34
1 2 5 13 21 34
1 2 8 13 21 34
1 3 5 8 13 21
1 3 5 8 13 34
1 3 5 8 21 34
1 3 5 13 21 34
1 3 8 13 21 34
1 5 8 13 21 34
2 3 5 8 13 21
2 3 5 8 13 34
2 3 5 8 21 34
2 3 5 13 21 34
2 3 8 13 21 34
2 5 8 13 21 34
3 5 8 13 21 34
```
## 作業繳交方式 Assignment Submission Instructions
* 交至ilearn作業繳交區
* 原始碼檔名以 學號_題號.c 命名 (example. D1109070_01.c, D1109070_02.c)
* 僅一個檔案上傳(限定 C 語言)
* [作業網址](https://oj.fcu.edu.tw/contest/1409/problems)
* 密碼:week02_0917