Advertisement
MrSossa

Untitled

Feb 24th, 2020
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.75 KB | None | 0 0
  1. import java.util.ArrayList;
  2. import java.util.Scanner;
  3.  
  4. public class Neko {
  5.     public static void main(String[] args) {
  6.         Scanner read = new Scanner(System.in);
  7.         int n = read.nextInt();
  8.         int m = read.nextInt();
  9.         ArrayList<Integer> chess=new ArrayList<>();
  10.         for (int i = 0; i < n; i++) {
  11.             chess.add(read.nextInt());
  12.         }
  13.         int ans=0;
  14.         for (int i = 0; i < m; i++) {
  15.             int keys = read.nextInt();
  16.             for (int j = 0; j < chess.size(); j++) {
  17.                 if ((chess.get(j)+keys)%2!=0) {
  18.                     ans+=1;
  19.                     chess.remove(j);
  20.                     break;
  21.                 }
  22.             }
  23.         }
  24.         System.out.println(ans);
  25.     }
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement