改了好久的代码percolation,还是在小伙伴的帮助下得以通过得到了92分。还是代码能力好差。总结了一下出错的地方。
import edu.princeton.cs.algs4.StdIn;
import edu.princeton.cs.algs4.StdOut;
import edu.princeton.cs.algs4.StdRandom;
import edu.princeton.cs.algs4.StdStats;
public class PercolationStats {
private double[] thresholds;
public PercolationStats(int n, int trials) {
if (n <= 0 || trials <= 0)
throw new IllegalArgumentException();
thresholds = new double[trials];
for (int i = 0; i < trials; i++) {
int count = 0;
Percolation percola