转微软的面试试题.doc

转 微软的面试试题 ? 日志 24)0xff;return this.FONTMAP.substring(2*(id-1),2*id);}color=#000000 size=4微软的面试试题各位看看这个微软的面试试题的c语言算法对吗?楼主fgq 841103(冯志宏)2006-05-05 06:57:21在C/C++/C语言提问这是csdn的一个帖子:求第1500个只有2,3,5因子的数数是从小到大排列第一个数是1,1=2^0*3^0*5^0要求用C实现,至少要讲清楚算法思路---第1500个数大约要六分钟,确实不行!还不知结果正不正确!859963392!---long result[1500];int p2,p3,p5;int i;result[0]=1;p2=p3=p5=0;for(i=1;i 1500;i++){int min=result[p2]*2;int choice=2;if(min result[p3]*3){min=result[p3]*3;choice=3;}if(min result[p5]*5){min=result[p5]*5;choice=5;}result=min;switch(choice){case 2:p2++;break;case 3:p3++;break;case 5:p5++;break;}printf(%d,result[1500-1

文档评论(0)

1亿VIP精品文档

相关文档