编号为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
敢达决战官方正版 安卓版v6.7.9
下载敢达决战 安卓版v6.7.9
下载像素火影骨架佐助 (Perseverance Fire Shadow)手机版v1.16
下载要塞英雄 安卓版v33.20.0-39082670-Android
下载梦想城镇vivo最新版本 安卓版v12.0.1
梦想城镇vivo版是这款卡通风模拟经营类手游的渠道服版本,玩
怦然心动的瞬间 安卓版v1.0
怦然心动的瞬间是一款真人向的恋爱互动游戏,在游戏中玩家将扮演
曼尼汉堡店游戏 安卓版v1.0.3
曼尼汉堡店是一款非常好玩的精品恐怖类型冒险游戏,在这款游戏中
现代总统模拟器去广告版 安卓版v1.0.46
现代总统模拟器是一款休闲养成类游戏,可能对于不少的玩家来说都
现代总统模拟器付费完整版 安卓版v1.0.46
现代总统模拟器高级版在商店是需要付费的,相对于普通版本,高级