11863 - 電機系 (資電館R406, R407) 上機考
|
Time |
Memory |
| Case 1 |
1 sec |
32 MB |
| Case 2 |
1 sec |
32 MB |
| Case 3 |
1 sec |
32 MB |
| Case 4 |
1 sec |
32 MB |
| Case 5 |
1 sec |
32 MB |
| Case 6 |
1 sec |
32 MB |
| Case 7 |
1 sec |
32 MB |
| Case 8 |
1 sec |
32 MB |
| Case 9 |
1 sec |
32 MB |
| Case 10 |
1 sec |
32 MB |
Description
Determine whether a matrix contains at least one sequence that each preceding number is NOT a factor of its immediately successive number from the top-left corner to the bottom-right corner. Print Yes or No.
- Examples that a preceding number is a factor of its immediately successive number

- Examples that a preceding number is NOT a factor of its immediately successive number

- An exampling matrix that contains at least a valid sequence:

Hints:
- No need to print out the sequence.
- Each number can be reached by up to four directions.
- Matrices are consisted of 1~9.
- Matrix width and height < 100.
- The answers are the same no matter cycles are allowed or not in the sequences.
- Avoid your program from running into an endless cycle.
Input

Output
- Additionally print Yes or No after each matrix.

Tags