题解 | #进制转换#

进制转换

https://www.nowcoder.com/practice/8f3df50d2b9043208c5eed283d1d4da6

#include <iostream>
#include <string>
using namespace std;

int main() {
    std::string str;
    std::getline(std::cin,str);
    std::cout<<std::stoi(str,nullptr,16)<<"\n";
}
// 64 位输出请用 printf("%lld")

字符串==>数字 std::stoi系列

数字==>符串std::to_string系列

全部评论

相关推荐

点赞 收藏 评论
分享
牛客网
牛客企业服务