摘要: //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 阅读全文
posted @ 2012-04-10 22:01 加拿大小哥哥 阅读(203) 评论(0) 推荐(0) 编辑
摘要: 阅读全文
posted @ 2012-04-10 14:11 加拿大小哥哥 阅读(130) 评论(0) 推荐(0) 编辑
摘要: //数组法约瑟夫环//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 阅读全文
posted @ 2012-04-10 13:37 加拿大小哥哥 阅读(204) 评论(0) 推荐(0) 编辑
点击右上角即可分享
微信分享提示