| Task: | Ruudukko | 
| Sender: | adex720 | 
| Submission time: | 2022-11-09 15:49:00 +0200 | 
| Language: | Java | 
| Status: | COMPILE ERROR | 
Compiler report
input/D.java:6: error: cannot find symbol
        Scanner scanner = new Scanner(System.in);
        ^
  symbol:   class Scanner
  location: class D
input/D.java:6: error: cannot find symbol
        Scanner scanner = new Scanner(System.in);
                              ^
  symbol:   class Scanner
  location: class D
2 errorsCode
public class D {
    public static final int MODULO = (int) (Math.pow(10, 9)) - 7;
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = Integer.parseInt(scanner.nextLine());
        int[][] luvut = new int[n][n];
        long[][] seuraavat = new long[n][n];
        for (int y = 0; y < n; y++) {
            String[] luvutString = scanner.nextLine().split(" ");
            for (int x = 0; x < n; x++) {
                luvut[x][y] = Integer.parseInt(luvutString[x]);
            }
        }
        long yhteensa = 0;
        for (int nykyinen = 1; nykyinen <= n * n; nykyinen++) {
            for (int x = 0; x < n; x++) {
                for (int y = 0; y < n; y++) {
                    if (luvut[x][y] == nykyinen) {
                        if (nykyinen == 1) {
                            seuraavat[x][y] = 1;
                            yhteensa++;
                            continue;
                        }
                        long seuraavia = 1; // 1 koska reitti voi loppua tähän ruutuun
                        for (int newY = 0; newY < n; newY++) {
                            if (newY == y) continue;
                            if (luvut[x][newY] < nykyinen) {
                                seuraavia += seuraavat[x][newY];
                            }
                        }
                        for (int newX = 0; newX < n; newX++) {
                            if (newX == x) continue;
                            if (luvut[newX][y] < nykyinen) {
                                seuraavia += seuraavat[newX][y];
                            }
                        }
                        seuraavia = seuraavia % MODULO;
                        yhteensa += seuraavia;
                        seuraavat[x][y] = seuraavia;
                    }
                }
            }
        }
        System.out.println(yhteensa % MODULO);
    }
}
