import java.util.*;
public class YueSeFu {
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
String str = s.nextLine();
String[] ss = str.split(",");
int n = Integer.valueOf(ss[0]);
int m = Integer.valueOf(ss[1]);
if(n<1||m<1){
System.out.println(-1);
}
int last = 0;
for(int i=2;i<=n;i++){
last = (last+m)%i;
}
System.out.println(last+1);
}
}
约瑟夫环
最新推荐文章于 2024-04-16 12:11:58 发布