题解 | #进制转换#

进制转换

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

//还有stoi这个好用的用法,记录一下
#include <iostream>
#include <string>
#include <vector>
using namespace std;

int main(){
    string num_str;
    vector<int> storage;
    while(cin>>num_str)
        storage.push_back(stoi(num_str, 0, 16));
    for(auto num:storage)
        cout << num << endl;
}

全部评论

相关推荐

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