Psst.. new poll here.
Psst.. new forums here.
Microsoft is blocking us again (TY IP Reputation!) so just use oauth login instead. :)
Paste
Pasted as Delphi by Вася ( 15 years ago )
import java.util.*;
import java.io.*;
import java.math.*;
public class Main {
public static void main(String[] args) throws IOException {
StreamTokenizer in = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));
PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));
in.nextToken();
int n = (int) in.nval;
in.nextToken();
int m = (int) in.nval;
int[] board = new int[n * m];
boolean[] board_stat = new boolean[n * m];
int end = n * m;
for (int i = 0; i < end; i++) {
in.nextToken();
board[i] = (int) in.nval;
}
in.nextToken();
int people = (int) in.nval;
int[] man = new int[people];
for (int i = 0; i < people; i++) {
in.nextToken();
man[i] = (int) in.nval;
}
Arrays.sort(board);
Arrays.sort(man);
Arrays.fill(board_stat, false);
int all = 0;
for (int i = 0; i < people; i++) {
for (int j = 0; j < end; j++) {
if (board_stat[j] == false && board[j] >= man[i]) {
all++;
board_stat[j] = true;
break;
}
}
}
out.print(all);
out.close();
}
}
Revise this Paste
Parent: 10876