Advertisement
bkit4s0

[array in java] can't change final length of array

Apr 2nd, 2015
201
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.15 KB | None | 0 0
  1. import java.util.ArrayList;
  2. import java.util.Scanner;
  3.  
  4. class type {
  5.     /*
  6.      * static int min(int a[]) { if (a.length == 0) return -1; else { int min =
  7.      * 0; for (int i = 0; i < a.length; i++) { if (a[i] < min) min = a[i]; }
  8.      * return min; } }
  9.      */
  10.     /*
  11.      * static void remove(int a[], int value) { // if have two value has the
  12.      * same value??? for(int i=0; i< a.length; i++) { if(a[i]==value) { for(int
  13.      * j =i; j<a.length;j++) { a[j] = a[j+1]; } a.length-=1; //final array
  14.      * length can not be assign break; } } }
  15.      */
  16.     public static void main(String args[]) {
  17.         int pie, rack, a, n, count;
  18.         ArrayList pies = new ArrayList();
  19.         ArrayList racks = new ArrayList();
  20.         Scanner scanner = new Scanner(System.in);
  21.         a = scanner.nextInt();
  22.         while (a-- > 0) {
  23.             n = scanner.nextInt();
  24.             for (int i = 0; i < n; i++) {
  25.                 pies.add(scanner.nextInt());
  26.             }
  27.             for (int i = 0; i < n; i++) {
  28.                 racks.add(scanner.nextInt());
  29.             }
  30.             while (pie=min(pies.toArray())!=-1) {
  31.                 while ((rack = min(racks)) != -1 && rack >= pie) {
  32.                     // remove rack from racks array
  33.                 }
  34.                 // remove both rack and pie
  35.                 // update count
  36.             }
  37.             ;
  38.         }
  39.  
  40.     }
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement