Java Reference
In-Depth Information
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
———————————————
Drop a red disk at column (0-6):
0
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
|R| | | | | | |
———————————————
Drop a yellow disk at column (0-6):
3
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
|R| | |Y| | | |
. . .
. . .
. . .
Drop a yellow disk at column (0-6):
| | | | | | | |
| | | | | | | |
| | | |R| | | |
| | | |Y|R|Y| |
| | |R|Y|Y|Y|Y|
|R|Y|R|Y|R|R|R|
———————————————
The yellow player won
6
*7.21
( Central city ) Given a set of cities, the central point is the city that has the shortest
total distance to all other cities. Write a program that prompts the user to enter the
number of the cities and the locations of the cities (coordinates), and finds the cen-
tral city.
Enter the number of cities:
Enter the coordinates of the cities:
5
2.5 5 5.1 3 1 9 5.4 54 5.5 2.1
The central city is at (2.5, 5.0)
*7.22
( Even number of 1s ) Write a program that generates a 6-by-6 two-dimensional
matrix filled with 0s and 1s, displays the matrix, and checks if every row and every
column have an even number of 1s.
*7.23
( Game: find the flipped cell ) Suppose you are given a 6-by-6 matrix filled with 0s
and 1s. All rows and all columns have an even number of 1s. Let the user flip one
VideoNote
Even number of 1s
Search WWH ::




Custom Search