摘要: #include #include using namespace std;int main(){ char str[80]; //int arr[80], temp, pos = 0, n = 0, i, max = 0, flag; int temp; int pos = 0; bool flag ; int maxnumer = 0; printf("请输入字符串:\n"); scanf("%s", str); while (str[pos] != '\0') { temp = 0; flag = false;//设置是否有整数的标 阅读全文
posted @ 2013-09-27 22:21 l851654152 阅读(1161) 评论(0) 推荐(0) 编辑
摘要: void func(const char *str){ int len = 0; int max_len = 0; const char *max_pos = str; for (;;) { if ('0' max_len) { max_len = len; max_pos = str - len; } len = 0; if (0 == *str) { ... 阅读全文
posted @ 2013-09-27 22:00 l851654152 阅读(313) 评论(0) 推荐(0) 编辑
摘要: 一台计算机有1KB内存和1MHZ的处理器,能在该机上运行且确定性终止的所有程序中,最长的运行时间是多少,要求写出推理过程,可作出任意假设。我假设该机是但用户单任务操作系统,实地址模式,运行的程序就是在不断不重复地更改内存状态,程序结束的终止状态为内存的某一确切状态,定义为终止态。于是推理过程如下:1KB的内存共有状态:2^(1024*8) 种1MHZ的处理器每一秒钟可以更改内存状态的次数为: 10^6 次因此,如果一个应用程序,从某个状态出发,遍历了所有的中间状态,最终到大终止态后结束,经历的这段时间即为程序运行的最长时间。为:(2^(1024*8)-1)/10^6 秒 阅读全文
posted @ 2013-09-27 20:17 l851654152 阅读(208) 评论(0) 推荐(0) 编辑