108 Data Structure Homework 1 1 Twodimension array

• Slides: 8

108 Data Structure Homework 1

1. Two-dimension array problem •

2. Zombie Problem 1) Design a maze (7 X 7) Generate 0 and 1 randomly 0 : alive people 1 : the working dead(zombie) 2 : infected people The number of 1 > = 80% (0, 0)→ 存活的人: 0 死亡的人: 1 座標: none (10% ) (15%) 2) Find the people who is infected 3) Show many people survive and several people are infected (5%) • Print the coordinates of the surviving people 4) Turn the “ 2” into a random number (3~1000) • If the number is a “perfect number: This person can be resurrected • 例如：第一個完全數是 6，它有因數 1、2、3、6，除去它本身 6外，其餘 3個數相加，1+2+3＝ 6，恰好等於本身。 第二個完全數是 28，它有因數 1、2、4、7、14、28，除去它本身 28外，其餘 5個數相加，1+2+4+7+14＝ 28，也恰 好等於本身。 (10%)

3. Lake Problem • Design a maze (15 X 15) - Generate 0 to 4 randomly 0 : land (dry) 1 ~ 4 : depth of water (from shallow to deep) Number of zero > 50 % N、W、S、E • 3. Find the lake with the most water 1) Print the maze like Page 5 and 7 (10%) 2) Print the coordinates of the biggest lake (10%) 3) Print the total number of the water that is the biggest lake (10%)

Lake Problem (0, 0)→ 0 2 0 4 3 3 4 1 4 2 1 3 0 1 2 2 0 4 1 0 0 0 0 1 3 0 4 0 0 0 4 1 0 4 0 4 0 0 3 4 1 0 0 0 1 4 3 0 0 2 0 4 0 0 0 3 3 0 0 0 3 4 0 0 3 0 0 4 0 2 0 4 1 0 0 4 1 3 2 1 0 0 0

Lake Problem (0, 0)→ 0 2 0 4 3 3 4 1 4 2 1 3 0 1 2 2 0 4 1 0 0 0 0 1 3 0 4 0 0 0 4 1 0 4 0 4 0 0 3 4 1 0 0 0 1 4 3 0 0 2 0 4 0 0 0 3 3 0 0 0 3 4 0 0 3 0 0 4 0 2 0 4 1 0 0 4 1 3 2 1 0 0 0

• Send code and result (screenshot) • E-mail: ext [email protected] com • Filename: HW 1_姓名_題號 • Only accepted C • Dev-C++ • Deadline: 11/11 18: 00 • 抄襲嚴懲 , 請打上註解不然不計分