关于C++int 转 字符串(string)
  • 板块学术版
  • 楼主world_execute
  • 当前回复6
  • 已保存回复6
  • 发布时间2020/8/5 16:06
  • 上次更新2023/11/6 21:14:20
查看原帖
关于C++int 转 字符串(string)
115196
world_execute楼主2020/8/5 16:06
inline char Makenumber(const int x) {
	return x^48;
}
inline std::string Makenumber(int x) {
	if (!x)
		return "0";
	static std::string s;
	for (s = ""; x; x/=10)
		s = Makenumber(x%10)+s;
	return s;
}

此函数的时间复杂度应该是 O(k2)O(k^2) 的( kkxx 的位数)

时间卡在关于字符串与字符的加法上了

O(k)O(k) 时间复杂度的的算法

2020/8/5 16:06
加载中...