摘要:
如果用传统的方法,先把所有的数加起来再除以个数,求和时可能溢出,所以不能用这种方法。 新的算法: 前n(n>0)个数的平均数 = 前(n-1)个数的平均数 + (第n个数 - 前(n-1)个数的平均数)/ n #include <stdio.h> #include <string.h> #inclu
阅读全文
posted @ 2022-09-08 13:15
高级打杂工程师
阅读(117)
推荐(0)
摘要:
#include <stdio.h> #include <string.h> #include "string" using namespace std; //把大数的高位/低位翻转 string reverseString(string str) { int iLen = str.length()
阅读全文
posted @ 2022-09-08 13:08
高级打杂工程师
阅读(44)
推荐(0)