Linux下
#include <stdlib.h>
#include <stdio.h>
int main()
{
int n,m,i,s = 0;
printf("Entr N, M = ");
scanf("%d%d", &n, &m);
for(i=2; i<=n; i++)
{
s = (s+m) % i;
}
printf("\n the winner is %d\n", s+1);
}
Linux下
#include <stdlib.h>
#include <stdio.h>
int main()
{
int n,m,i,s = 0;
printf("Entr N, M = ");
scanf("%d%d", &n, &m);
for(i=2; i<=n; i++)
{
s = (s+m) % i;
}
printf("\n the winner is %d\n", s+1);
}
转载于:https://www.cnblogs.com/eternal1025/p/4397703.html