Advertisement
Guest User

Untitled

a guest
May 27th, 2018
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.89 KB | None | 0 0
  1. import java.io.*;
  2. import java.util.*;
  3.  
  4. public class HuxleyCode {
  5.   public static void main(String args[]) {
  6.             Scanner in = new Scanner(System.in);
  7.         int naves = in.nextInt();
  8.         int qtdSetores = in.nextInt();
  9.         int capacidadeCadaSetor = in.nextInt();
  10.         int qtdPessoas = in.nextInt();
  11.         int [][]evacuacao= new int[naves][qtdSetores];
  12.         int [][]evacuacao2= new int[qtdSetores][capacidadeCadaSetor];
  13.        
  14.  
  15.        
  16.  
  17.             for(int linha = 0; linha < qtdPessoas;linha++) {
  18.  
  19.                 for(int coluna = 0;coluna < qtdPessoas;coluna++){
  20.  
  21.                     if(evacuacao[linha][coluna] <= evacuacao2[linha][coluna]) {
  22.                         evacuacao2[coluna][linha]-=evacuacao[coluna][linha];
  23.                         }
  24.                 }  
  25.                
  26.                 for(int k = 0;k < qtdPessoas;k++){
  27.                     for(int l = 0;l < qtdPessoas;l++){
  28.                         System.out.print("Nave "+evacuacao[k][l]+": "+evacuacao2[k][l]);                   
  29.                     }
  30.                    
  31.                     }
  32.                 }      
  33.                
  34.     }  
  35.                    
  36.    
  37.  
  38.  
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement