Guest User

Untitled

a guest
Feb 4th, 2019
46
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.62 KB | None | 0 0
  1. import java.util.*;
  2.  
  3. public class Main {
  4.     public static void main (String[] args) {
  5.         Scanner s = new Scanner(System.in);
  6.         List l = new ArrayList();
  7.         int k = s.nextInt();
  8.         int m = s.nextInt();
  9.         int r;
  10.         for (int i = 0; i < k; i++) {
  11.             l.add(i + 1);
  12.         }
  13.         for (int i = 0; i < m; i++) {
  14.             r = s.nextInt();
  15.             int size = l.size();
  16.             for (int j = 0; j < size / r; j++) {
  17.                 l.remove(r * (j + 1) - j - 1);
  18.             }
  19.         }
  20.         for (Object aL : l) {
  21.             System.out.println(aL);
  22.         }
  23.     }
  24. }
Add Comment
Please, Sign In to add comment