Advertisement
Guest User

Untitled

a guest
Feb 26th, 2019
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 5 1.30 KB | None | 0 0
  1. package aer395;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class AER395 {
  6.    
  7.     static Scanner in = new Scanner(System.in);
  8.  
  9.     public static int cortes(boolean[][] tableta, int fini, int cini, int ffin, int cfin) {
  10.         int chocos = 0;
  11.         int almendras = 0;
  12.         boolean trozoLimpio = true;
  13.         int f = fini;
  14.        
  15.         while (trozoLimpio && f < ffin) {
  16.             int c = cini;
  17.             while (trozoLimpio && c < cfin) { {
  18.                 if (tableta[f][c]) {
  19.                     almendras++;
  20.                 } else {
  21.                     chocos++;
  22.                 }
  23.                 trozoLimpio = (chocos == 0 || almendras == 0);
  24.             }
  25.         }
  26.         if (trozoLimpio) {
  27.             return 0;
  28.         } return
  29.            
  30.     }
  31.    
  32.     public static void caso() {
  33.         int filas = in.nextInt();
  34.         int columnas = in.nextInt();
  35.         boolean[][] tableta = new boolean[filas][columnas];
  36.         for (int f  = 0; f < filas; f++) {
  37.             String cadenaFila = in.next();
  38.             for (int c = 0; c < columnas; c++) {
  39.                 tableta[f][c] = cadenaFila.charAt(c) == '#';
  40.             }
  41.         }
  42.     }
  43.  
  44.     public static void main(String[] args) {
  45.        
  46.        while (in.hasNext()) {
  47.            caso();
  48.        }
  49.     }
  50.    
  51. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement