Advertisement
Guest User

how Hitler decided which Jews to gas

a guest
Feb 3rd, 2019
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.98 KB | None | 0 0
  1. import java.util.Scanner;
  2. import java.util.ArrayList;
  3.  
  4. public class PartyInvitation
  5. {
  6. /** k amount of friends, m amount of rounds,
  7. in round i, remove all friends
  8. in a position that is multiple of i */
  9.  
  10.   public static void main(String[] args){
  11.  
  12.   Scanner s=new Scanner(System.in);
  13.   ArrayList<Integer> executionList= new ArrayList<Integer>();
  14.   int[] kill= new int[10];
  15.  
  16.   int victimNum= s.nextInt();
  17.   int roundNum=s.nextInt();
  18.  
  19.   for(int i=0; i<roundNum; i++){
  20.     kill[i]=s.nextInt();
  21.   }
  22.  
  23.   for(int i=0; i<victimNum; i++) {
  24.   executionList.add(i+1);
  25.   }
  26.  
  27.   for(int i=0; i<roundNum; i++) {
  28.     for(int o=0; o< executionList.size(); o++){
  29.       if((o+1)%kill[i]==0){
  30.         executionList.set(o,-1);
  31.       }
  32.     }
  33.     for(int o=0; o< executionList.size(); o++){
  34.       if(executionList.get(o)==-1)
  35.         executionList.remove(o);
  36.     }
  37.   }
  38.  
  39.     for( int ethnicCleansing: executionList){
  40.      System.out.println(ethnicCleansing);
  41.     }
  42.    
  43.   }
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement