知识点
- 最大公约数
- 两数互质的条件
1.1.30 数组练习。编写一段程序,创建一个 N×N 的布尔数组 a[][]。其中当 i 和 j 互质时(没有相同 因子),a[i][j] 为 true,否则为 false。
1.1.30 Array exercise. Write a code fragment that creates an N-by-N boolean array a[][] such that a[i][j] is true if i and j are relatively prime (have no common factors), and false otherwise.
分析
答案
###测试用例
public static void main(String[] args) {
boolean[][] resultArray = boolArray(9);
for (int i = 0; i < resultArray.length; i++) {
System.out.println(Arrays.toString(resultArray[i]));
}
}
####视频分析
###代码索引
### 广告
。