第二道,始终不知道哪出了问题,28.7%,坐着怀疑人生
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map.Entry;
import java.util.Scanner;
import java.util.Set;

public class Main2 {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
char[] output = new char[100];
int m = in.nextInt();
NumberOffGame(m, output);
in.close();
}

static void NumberOffGame(int m, char[] output) {
if(m<=1 || m>=100) {
System.out.println("ERROR!");
}
else {
HashMap<Integer, Integer> fc = new HashMap<Integer, Integer>();
for(int i=1; i<=100; i++) {
fc.put(i, i);
}
int count=1;
List<Integer> flag = new ArrayList<Integer>();
while(fc.keySet().size() >= m) {
Set<Integer> key = fc.keySet();
for(Integer k : key) {
if(count == m) {
flag.add(k);
count = 1;
}
else {
count++;
}
}
for(int i=0; i<flag.size(); i++) {
fc.remove(flag.get(i));
}
flag.clear();
}
count = 0; 
for(Entry<Integer, Integer> entry : fc.entrySet()) {
System.out.printf("%d",entry.getKey());
if(count!=fc.size()-1) {
System.out.printf(",");
}
count++;
}
}
}
}