摘要:
//Dev c++#include<stdio.h>#include<malloc.h>#include<string.h>//调用putchar函数typedef struct stu{ int num; struct stu*next;}stu,*pointer;int main(){ int i,n,m,count; pointer p,q,r; r=p=q=(pointer)malloc(sizeof(pointer)); p->num=1;p->next=NULL;//无头结点 printf("Input n and m:&q 阅读全文
摘要:
阅读全文
摘要:
//数组法约瑟夫环//1000人限制,#include<stdio.h>#include<string.h>int main(){ int a[1000]; int count=0;int i,j=0;int m,n; printf("Input n and m:"); scanf("%d%d",&n,&m); for(i=1;i<=n;i++) a[i]=1;//刚开始全在圈中 for(i=1;count<n-1;i=i%n+1)//i从1到n反复循环 { if(1==a[i]) { j++; } i 阅读全文