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);
}
时间: 2024-10-13 10:24:02
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);
}