#include<stdio.h>int main(){ int n,d; while(~scanf("%d %d",&n,&d))//输入总人数和去除数 { long long w=0; for(int i=2;i<=n;i++) w=(w+d)%i; printf("%d %d %I64d ",n,d,w+1); } return 0;}
题目链接
http://acm.hdu.edu.cn/showproblem.php?pid=2925