请问它的时间复杂度是多少
n=100;
m=99;
while(n>=0){
if(m>0) {n--;m=m-10; continue;}
else m=m+1;}
}
请问它的时间复杂度是多少
n=100;
m=99;
while(n>=0){
if(m>0) {n--;m=m-10; continue;}
else m=m+1;}
}
请问它的时间复杂度是多少
2006-03-29 09:58
这个问题很有意思啊
2006-03-29 10:49
2006-03-29 18:36
1003次
交你一个很简单的方法
不要自己算,呵呵,编译下面程序!
#include <stdio.h>
main()
{int n,m,count;
n=100;
m=99;
count=0;
while(n>=0){
if(m>0) {n--;m=m-10;count++; continue;}
else m=m+1;
count++;
}
printf("%d",count);
getch();
}

2006-03-29 21:43
楼上的,我不是问你它执行的次数
我问的是那道程序的时间复杂度是什么
2006-03-29 22:51
2006-03-30 18:01
2006-03-30 18:04
2006-03-30 20:46
2006-03-30 22:07
2006-03-30 22:19