




已阅读5页,还剩12页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1.打开注册表编辑器定位到:HKEY_LOCAL_MACHINE|SOFTWARE|Microsoft|Windows|CurrentVersion|Uninstall,并在 Uninstall 中建立一个名为 KB923980 的子键。(如果已经存在则无需建立)2.修改 KB923980 子键的“默认”值,将其值设置为:This Key is required to STOP Windows Update from prompting for an install。然后关闭注册表编辑器并重新启动 Windows。3.重新启动 Windows 后,再次打开注册表编辑器,定位到:HKEY_LOCAL_MACHINE|SOFTWARE|Microsoft|Updates|Windows XP|SPX(其中 SPX 的 X 是数字,如果你的系统是 Windows XP SP2,则 X 是 3;如果是 Windows XP SP1,则 X 是 2),把这个注册表项中的 KB923980 子键删除。然后关闭注册表编辑器并重新启动 Windows。典型的约瑟夫环问题。原问题比你的问题要复杂一点。我以前写的程序:1.用数组。# include stdio.h# define SIZE 100main() int m,n,i; int arraySIZE; printf(约瑟夫环求解,当前设置最大人数为%d.n,SIZE); printf(报数上限:n); scanf(%d,&m); printf(总人数为:n); scanf(%d,&n); for(i=0;in;i+) printf(第%d人的密码为:,i+1); scanf(%d,&arrayi); joseph(array,m,n);int joseph(a,m,n)int a,m,n; int bSIZE; /*计录编号数组.*/ int i; /*计数器.*/ int flag=0; int code; /*删取人的号码.*/ int sum=n; /*现存人数.*/ int point=0; /*当前报数人的位置.*/ int num=m; for(i=0;in;i+) /*计录数组.*/ bi=i+1; while(sum!=0) /*当人数不为零时继续循环.*/ for(i=1;i=sum) /*当前报数位置超过最后一人时从第一人报起.*/ point=1; else point+; num=apoint-1; /*取密码.*/ code=bpoint-1; /*取号码.*/ for(i=point;inum); printf(密码:); scanf(%d,&p2-secret); p1=(struct player *)malloc(LEN); p2-next=p1; while(p2-num!=0); p-next=head; free(p1);void delete(struct player *head,int m) int i; struct player *p,*q; int sum; p=head; sum=m; while(n!=0) for(i=1;inext; printf(%d,p-num); sum=p-secret; q-next=p-next; p=p-next; n=n-1; 题目:有n个人围成一圈,顺序排号。从第一个人开始报数(从1到3报数),凡报到3的人退出圈子,问最后留下的是原来第几号的那位。1. 程序分析:2.程序源代码:#define nmax 50main()int i,k,m,n,numnmax,*p;printf(please input the total of numbers:);scanf(%d,&n);p=num;for(i=0;in;i+)*(p+i)=i+1;i=0;k=0;m=0;while(m next!=NULL)/*输出新建单链表后的各元素*/ printf(%d,p- next -data); p=p- next; printf(n); h= inverse(h); /*调用nzlb(逆置链表)函数*/ while(h- next!=NULL)/*输出逆置后的单链表各元素*/ printf(%d,h- next -data); h=h- next; getch(); /*调用getch函数,不知道什么意思的自己查查!*/ slink * creatslink() /*新建链表函数*/ slink *h,*l,*a; int i; h=( slink *)malloc(sizeof(slink); /*创建头结点*/ h- next =NULL; a=h; for(i=0;idata=i; a- next =l; a=a- next; a- next =NULL; return h; slink * inverse (slink *h) /*逆置链表函数*/ slink *p,*q; p=h- next; h- next =NULL; while(p!=NULL) q=p; p=p- next; q- next =h- next; h- next =q; return h; 单链表逆置算法单链表逆置算法struct nodeint num;struct node *next;struct node* reverse(struct node *head)/head 链表头结点struct node *p,*temp1,*temp2; if(head=NULL_) return head; /|head-next=NULLp=head-next;head-next=NULL;while(_) /p!=NULL或ptemp1=head;_; /head=p;temp2=p;p=p-next;_; /temp2-next=temp1;或head-next=temp1;/Match while statenmentreturn head; /返回逆置后的链表的头结点 struct nodeint num;struct node *next;struct node* reverse(struct node *head)/head 链表头结点struct node *p,*temp1,*temp2; if(head=NULL|head-next=NULL) return head; p=head-next;head-next=NULL;while(p!=NULL或p)temp1=head;head=p; temp2=p;p=p-next;temp2-next=temp1;或head-next=temp1; /Match while statenmentreturn head; /返回逆置后的链表的头结点 最大子列和 n的阶乘中有多少个0 10进制to2进制 单链表逆置 判断链表中是否有环 文件中有多少行#ifndef MYLIST_H#define MYLIST_H#include struct listnodeint value;listnode *next;listnode ( int num ): value (num), next (NULL);class Mylistpublic:Mylist ();Mylist ();void Insert ( int value ) ;std:string GetEntireList ();void Reverse ();private:listnode *head;#endif/-#include Mylist.husing namespace std;Mylist:Mylist ()head = NULL;Mylist:Mylist()if ( head != NULL )listnode *temp = head ;while ( head != NULL )temp = head-next;delete head;head = temp;void Mylist:Insert ( int value )if ( head = NULL )head = new listnode ( 0 );listnode *curnode = new listnode ( value );listnode *temp = head;while ( temp-next != NULL ) temp = temp-next;temp-next = curnode;string Mylist:GetEntireList ()string str = ;listnode *temp = head-next ;while ( temp != NULL )str += temp-value + 0 ;str += ;temp = temp-next;return str;void Mylist:Reverse ()if ( head = NULL | head-next = NULL )return;listnode *end = head;while ( end-next != NULL )end = end-next;listnode *curnode = head-next;while ( curnode != end )/ 将curnode从链表中删除head-next = curnode-next;/将curnode插入到end后面curnode-next = end-next;end-next = curnode;curnode = head-next;/ 判断链表中是否存在着环bool Mylist:HasaCycle ()listnode *itr1 = NULL;listnode *itr2 = NULL;/ 如果链表为空则返回falseif ( head = NULL | head != NULL & ( head-next = NULL ) )return false;itr1 = head-next;itr2 = itr1-next;if ( itr2 = NULL )return false;/ 如果head-next指向了head ,或者itr1-head 指向了itr1,或者itr1-next指向了head,有环if ( itr1 = head | itr2 = itr1 | itr2 = head )return true;/ head - itr1 - itr2 - * while ( itr1 != NULL & itr2 != NULL & itr2-next != NULL )if ( itr1 = itr2 | itr2-next = itr1 )return true;itr1 = itr1-next;itr2 = itr2-next-next;return false;/=/ test。cpp#include #include #include #include #include #include Mylist.husing namespace std;/=/ 获得data。txt文件中有多少行int GetTotalLineCount ()ifstream ifs;ifs.open ( data.txt, ios:in );int count = 1 ;/string p;/while ( getline( ifs, p ) ) +count; char ch;while ( ifs.get( ch ) ) if ( ch = n)+count;ifs.close();return count;/=/计算正整数num的阶乘中有多少个0const int FIVE = 5;/ 得到不大于 num的5的最大次方,如 num = 5 时返回 1, 26 时返回 2int LowerNearestPow ( int num )int powoffive = 1;while ( pow ( FIVE, powoffive ) 0 )zerocount += num / pow ( FIVE, lowernearestpow ) ; -lowernearestpow;return zerocount;/=/ 将10进制正整数num转化为2进制数const int TWO = 2 ;string DecimalToBin ( unsigned int num )if ( num = 0 )return 0;string binform = ;while ( num 0 )binform.insert ( binform.begin(), num % TWO + 0 );num /= TWO ;return binform;/=/ 求一个整数数组的最大子列和 int MaxSubArraySum ( int *array, int size )int sum = 0;while ( size = 0 )if ( arraysize 0 )sum += array size ;else if ( arraysize 0 )if ( sum = 0 )sum = arraysize;/ end of else-size;/ end of while return sum;/=void main ()/int count = GetTotalLineCount ();/cout count endl; /while ( 1 )/cout 请输入一个数,本程序将计算这个数的阶乘中有多少个0: num ;/cout GetZerosofXFactorial ( num ) endl;/while ( 1 )/cout 请输入一个正整数,本程序将计算这个数的二进制形式: num ;/cout DecimalToBin ( num ) endl;/Mylist intlist;/for ( int i=0; i8; +i )/intlist.Insert ( i );/string str = intlist.GetEntireList ();/cout 在逆置之前链表内容为: str endl;/intlist.Reverse();/str = intlist.GetEntireList ();/cout 在逆置之后链表内容为: str endl;/int sum = -1, -2, 0, -4, -6, -1; / -1/ 1, 2, -1, -4, 6, 1; / 10/int size = sizeof( sum ) / sizeof(int) - 1;/cout MaxSubArraySum ( sum , size ) endl;又n个人围成一圈,顺序排号.从第一个人开始报数(从1到m报数),凡报到m的人退出圈子,问最后留下的是原来第几号?链表:#include#includetypedef struct nodeint info;struct node *next;node *tbuildhlink(int n)/*带头节点的尾插法*/node *head,*s,*p2;int i=1;h
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 新材料研发推广项目合作协议书
- 中级银行从业资格之中级银行业法律法规与综合能力通关测试卷及答案详解【易错题】
- 自考专业(法律)能力检测试卷【考点提分】附答案详解
- 教育技术发展报告:2025年大数据在教育领域的应用研究
- 重难点解析吉林省和龙市中考数学真题分类(一元一次方程)汇编综合训练试卷(含答案详解)
- 电子竞技俱乐部运营管理创新报告:2025年品牌建设策略
- 自考专业(公共关系)测试卷及参考答案详解【培优B卷】
- 自考专业(护理)考试历年机考真题集及答案详解(名校卷)
- 资料员之资料员基础知识综合提升测试卷附参考答案详解【培优】
- 中级银行从业资格之中级银行业法律法规与综合能力能力测试B卷及答案详解(夺冠)
- 2025秋季开学初班主任会议德育副校长讲话:从‘知责’到‘善育’这4步你做到几步
- 新生儿病房护理安全管理
- 瑞雪迎春春节家宴主题说明书
- 军用车修理知识培训课件
- 医务人员职业道德准则(2025年版)全文培训课件
- 【课件】酷家乐工具操作基础课程-云设计5.0
- 医院介入手术病人护送交接流程
- 学校家庭教育指导(班主任培训班) 课件
- 骨关节结核教案
- 楼板厚度检测报告
- 精神发育迟滞课件
评论
0/150
提交评论