文章

34

粉丝

261

获赞

10

访问

11.3k

头像
IP地址 题解:就是判断是否合理有点点麻烦,其他还好
fzh VIP
P1023 贵州大学机试题
发布于2024年3月19日 21:07
阅读数 243

#include<bits/stdc++.h>
using namespace std;
int limit[4] = { 1000,100,10,100 };
int  ChangeStrToInt(string str)
{

    int result =   0;  
    for (int i = 0; i < str.size(); i++)
    {
        if (str[i] >= '0' && str[i] <= '9') result = result + (str[i] - '0') * pow(10, str.size() - 1 - i);
        else
        {
            return -1;
        }

    }
    return result;
}    


void Change(int x)
{
    vector<char> result;
    while (x > 0)
    {
        int t = x % 16;
        if (t >= 0 && t <= 9) result.push_back(...

登录查看完整内容


登录后发布评论

暂无评论,来抢沙发