Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- import java.util.ArrayList;
- public class PartyInvitation
- {
- /** k amount of friends, m amount of rounds,
- in round i, remove all friends
- in a position that is multiple of i */
- public static void main(String[] args){
- Scanner s=new Scanner(System.in);
- ArrayList<Integer> executionList= new ArrayList<Integer>();
- int[] kill= new int[10];
- int victimNum= s.nextInt();
- int roundNum=s.nextInt();
- for(int i=0; i<roundNum; i++){
- kill[i]=s.nextInt();
- }
- for(int i=0; i<victimNum; i++) {
- executionList.add(i+1);
- }
- for(int i=0; i<roundNum; i++) {
- for(int o=0; o< executionList.size(); o++){
- if((o+1)%kill[i]==0){
- executionList.set(o,-1);
- }
- }
- for(int o=0; o< executionList.size(); o++){
- if(executionList.get(o)==-1)
- executionList.remove(o);
- }
- }
- for( int ethnicCleansing: executionList){
- System.out.println(ethnicCleansing);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement