You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
auto to_num = [](char c) -> int64_t {
if (isdigit(c)) return c - '0';
return c - 'a' + 10;
};
int64_t res = 0;
for (auto e : str)
res = res * radix + to_num(e);
问题:
在string转int64_t的时候,代码倒序计算,并使用了pow()函数。
pow()函数返回是double类型的,计算十分缓慢。
建议直接顺序处理:
另附的我的完整code,https://blog.csdn.net/abcdefbrhdb/article/details/104663704
The text was updated successfully, but these errors were encountered: