编号为1,2,...,n的n个人按顺时针方向坐在圆桌边, 每人持有一密码(正整数),从第s人开始报数, 报到第m人出列, 再从下一人开始报, 直至所有的人都出列为止
下面是用数组的方法编的C语言源程序!仅供参考,欢迎多提宝贵意见!
#include
main()
{
int n,s,password;
int a[100];
int i,j,counter1=1,counter2=0;
printf("please input the value of n:");
scanf("%d",&n);
printf("please input the number of the biginer:");
scanf("%d",&s);
if(s>n)
{
printf("please reinput the number less than %d:",n);
scanf("%d",&s);
}
printf("please input the value of the password:");
scanf("%d",&password);
for(i=0;i
j=s-1;
while(counter2!=n)
{
while(password==1)
{
printf("%4d",a[j]);
counter2++;
if(counter2==n)
return;
if(j
else
j=0;
}
while(password!=1&&counter1!=password)
{
if(j
else
j=0;
while(a[j]==0)
{
if(j
else
j=0;
}
counter1++;
if(counter1==password)
{
printf("%4d",a[j]);
a[j]=0;
if(j
else
&nb
茶杯头甜蜜终章dlc 官方手机版v1.0.0.3
下载火柴人传说暗影格斗内置菜单 最新版v3.0.1
下载荒野乱斗测试服 安卓版v61.10.3
下载荒野乱斗彩虹服 安卓版v61.10.3
下载寒霜启示录 安卓版v1.25.10
寒霜启示录是一款生存模拟游戏,不少玩家可能对于末日都有着自己
末日城堡免广告版 安卓最新版v0.7.1
末日城堡免广告版是一款非常好玩的模拟经营类游戏,内部可以不看
甜蜜人生模拟器 最新版v1.4.5
甜蜜人生模拟器是一款非常好玩的模拟恋爱手游,玩家在这里能够对
武器锻造师内置功能菜单 v10.4
武器锻造师内置菜单版是游戏的破解版本,在该版本中为玩家提供了
开放空间overfield 安卓版v1.0.5
开放空间Overfield是一款箱庭养成经营手游,让你在广阔