CSES - Datatähti 2023 alku - Results
Submission details
Task:Lehmät
Sender:adex720
Submission time:2022-11-02 15:20:24 +0200
Language:Java
Status:COMPILE ERROR

Compiler report

input/B.java:57: error: reached end of file while parsing
}
 ^
1 error

Code

import java.util.Scanner;

public class B {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        String[] koot = scanner.nextLine().split(" ");

        int korkeus = Integer.parseInt(koot[0]);
        int leveys = Integer.parseInt(koot[1]);

        boolean alkanut = false;
        boolean loppunut = false;
        int lehmia = 0;

        for (int i = 0; i < korkeus; i++) {
            String rivi = scanner.nextLine();
            if (loppunut) continue;

            
            boolean sisalla = false;
            for (int i1 = 0; i1 < leveys; i1++) {
                char nykyinen = rivi.charAt(i1);

                /*
                if (nykyinen == '*') {
                    if (rivi.charAt(i1+1) == '*' && alkanut){
                        loppunut = true;
                        break;
                    }

                    if (sisalla) {
                        break;
                    } 

                    if (!alkanut) {
                        alkanut = true;
                        break;
                    }
                    sisalla = true;
                    continue;
                }

                if (nykyinen == '@' && sisalla) {
                    lehmia++;
                }

            } /* */

        }
        
        System.out.print(lehmia);

    }

}